bokeh.models.annotations

Renderers for various kinds of annotations that can be added to Bokeh plots

class Annotation(**kwargs)

Bases: bokeh.models.renderers.Renderer

Base class for annotation models.

plot

property type: plot:Instance(Plot)

The plot to which this annotation is attached.

JSON Prototype
{
  "id": "d7d6d60d-2540-4b24-b52f-edc2b47c6c7e",
  "level": "annotation",
  "name": null,
  "plot": null,
  "tags": [],
  "visible": true
}
class Arrow(**kwargs)

Bases: bokeh.models.annotations.Annotation

Render an arrow as an annotation.

end

property type: end:Instance(ArrowHead)

Instance of ArrowHead.

end_units

property type: end_units:Enum(‘screen’, ‘data’)

The unit type for the end_x and end_y attributes. Interpreted as “data space” units by default.

line_alpha

property type: line_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line alpha values for the arrow body.

line_cap

property type: line_cap:Enum(‘butt’, ‘round’, ‘square’)

The line cap values for the arrow body.

line_color

property type: line_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The line color values for the arrow body.

line_dash

property type: line_dash:DashPattern

The line dash values for the arrow body.

line_dash_offset

property type: line_dash_offset:Int

The line dash offset values for the arrow body.

line_join

property type: line_join:Enum(‘miter’, ‘round’, ‘bevel’)

The line join values for the arrow body.

line_width

property type: line_width:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line width values for the arrow body.

source

property type: source:Instance(DataSource)

Local data source to use when rendering annotations on the plot.

start

property type: start:Instance(ArrowHead)

Instance of ArrowHead.

start_units

property type: start_units:Enum(‘screen’, ‘data’)

The unit type for the start_x and start_y attributes. Interpreted as “data space” units by default.

x_end

property type: x_end:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The x-coordinates to locate the end of the arrows.

x_range_name

property type: x_range_name:String

A particular (named) x-range to use for computing screen locations when rendering annotations on the plot. If unset, use the default x-range.

x_start

property type: x_start:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The x-coordinates to locate the start of the arrows.

y_end

property type: y_end:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The y-coordinates to locate the end of the arrows.

y_range_name

property type: y_range_name:String

A particular (named) y-range to use for computing screen locations when rendering annotations on the plot. If unset, use the default y-range.

y_start

property type: y_start:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The y-coordinates to locate the start of the arrows.

JSON Prototype
{
  "end": {
    "id": "a3408d6a-1b1e-4a1b-8e0b-ec542852feac",
    "type": "OpenHead"
  },
  "end_units": "data",
  "id": "ea15e55c-a557-43b3-823b-0f9deb5935f9",
  "level": "annotation",
  "line_alpha": {
    "value": 1.0
  },
  "line_cap": "butt",
  "line_color": {
    "value": "black"
  },
  "line_dash": [],
  "line_dash_offset": 0,
  "line_join": "miter",
  "line_width": {
    "value": 1
  },
  "name": null,
  "plot": null,
  "source": null,
  "start": null,
  "start_units": "data",
  "tags": [],
  "visible": true,
  "x_end": null,
  "x_range_name": "default",
  "x_start": null,
  "y_end": null,
  "y_range_name": "default",
  "y_start": null
}
class BoxAnnotation(**kwargs)

Bases: bokeh.models.annotations.Annotation

Render a shaded rectangular region as an annotation.

bottom

property type: bottom:Either(Auto, NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float))

The y-coordinates of the bottom edge of the box annotation.

bottom_units

property type: bottom_units:Enum(‘screen’, ‘data’)

The unit type for the bottom attribute. Interpreted as “data space” units by default.

fill_alpha

property type: fill_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The fill alpha values for the box.

fill_color

property type: fill_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The fill color values for the box.

left

property type: left:Either(Auto, NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float))

The x-coordinates of the left edge of the box annotation.

left_units

property type: left_units:Enum(‘screen’, ‘data’)

The unit type for the left attribute. Interpreted as “data space” units by default.

line_alpha

property type: line_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line alpha values for the box.

line_cap

property type: line_cap:Enum(‘butt’, ‘round’, ‘square’)

The line cap values for the box.

line_color

property type: line_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The line color values for the box.

line_dash

property type: line_dash:DashPattern

The line dash values for the box.

line_dash_offset

property type: line_dash_offset:Int

The line dash offset values for the box.

line_join

property type: line_join:Enum(‘miter’, ‘round’, ‘bevel’)

The line join values for the box.

line_width

property type: line_width:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line width values for the box.

render_mode

property type: render_mode:Enum(‘canvas’, ‘css’)

Specifies whether the box is rendered as a canvas element or as an css element overlaid on the canvas. The default mode is “canvas”.

Warning

The line_dash and line_dash_offset attributes aren’t supported if the render_mode is set to “css”

right

property type: right:Either(Auto, NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float))

The x-coordinates of the right edge of the box annotation.

right_units

property type: right_units:Enum(‘screen’, ‘data’)

The unit type for the right attribute. Interpreted as “data space” units by default.

top

property type: top:Either(Auto, NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float))

The y-coordinates of the top edge of the box annotation.

top_units

property type: top_units:Enum(‘screen’, ‘data’)

The unit type for the top attribute. Interpreted as “data space” units by default.

x_range_name

property type: x_range_name:String

A particular (named) x-range to use for computing screen locations when rendering box annotations on the plot. If unset, use the default x-range.

y_range_name

property type: y_range_name:String

A particular (named) y-range to use for computing screen locations when rendering box annotations on the plot. If unset, use the default y-range.

JSON Prototype
{
  "bottom": null,
  "bottom_units": "data",
  "fill_alpha": {
    "value": 0.4
  },
  "fill_color": {
    "value": "#fff9ba"
  },
  "id": "cf956e5f-000a-4b64-baa2-736d72d309f8",
  "left": null,
  "left_units": "data",
  "level": "annotation",
  "line_alpha": {
    "value": 0.3
  },
  "line_cap": "butt",
  "line_color": {
    "value": "#cccccc"
  },
  "line_dash": [],
  "line_dash_offset": 0,
  "line_join": "miter",
  "line_width": {
    "value": 1
  },
  "name": null,
  "plot": null,
  "render_mode": "canvas",
  "right": null,
  "right_units": "data",
  "tags": [],
  "top": null,
  "top_units": "data",
  "visible": true,
  "x_range_name": "default",
  "y_range_name": "default"
}
class Label(**kwargs)

Bases: bokeh.models.annotations.TextAnnotation

Render a single text box as an annotation.

angle

property type: angle:Angle

The angle to rotate the text, as measured from the horizontal.

Warning

The center of rotation for canvas and css render_modes is different. For render_mode=”canvas” the label is rotated from the top-left corner of the annotation, while for render_mode=”css” the annotation is rotated around it’s center.

angle_units

property type: angle_units:Enum(‘deg’, ‘rad’)

Acceptable values for units are "rad" and "deg"

background_fill_alpha

property type: background_fill_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The fill alpha values for the text bounding box.

background_fill_color

property type: background_fill_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The fill color values for the text bounding box.

border_line_alpha

property type: border_line_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line alpha values for the text bounding box.

border_line_cap

property type: border_line_cap:Enum(‘butt’, ‘round’, ‘square’)

The line cap values for the text bounding box.

border_line_color

property type: border_line_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The line color values for the text bounding box.

border_line_dash

property type: border_line_dash:DashPattern

The line dash values for the text bounding box.

border_line_dash_offset

property type: border_line_dash_offset:Int

The line dash offset values for the text bounding box.

border_line_join

property type: border_line_join:Enum(‘miter’, ‘round’, ‘bevel’)

The line join values for the text bounding box.

border_line_width

property type: border_line_width:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line width values for the text bounding box.

render_mode

property type: render_mode:Enum(‘canvas’, ‘css’)

Specifies whether the text is rendered as a canvas element or as an css element overlaid on the canvas. The default mode is “canvas”.

Note

The CSS labels won’t be present in the output using the “save” tool.

Warning

Not all visual styling properties are supported if the render_mode is set to “css”. The border_line_dash property isn’t fully supported and border_line_dash_offset isn’t supported at all. Setting text_alpha will modify the opacity of the entire background box and border in addition to the text. Finally, clipping Label annotations inside of the plot area isn’t supported in “css” mode.

text

property type: text:String

The text value to render.

text_align

property type: text_align:Enum(‘left’, ‘right’, ‘center’)

The text align values for the text.

text_alpha

property type: text_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The text alpha values for the text.

text_baseline

property type: text_baseline:Enum(‘top’, ‘middle’, ‘bottom’, ‘alphabetic’, ‘hanging’, ‘ideographic’)

The text baseline values for the text.

text_color

property type: text_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The text color values for the text.

text_font

property type: text_font:String

The text font values for the text.

text_font_size

property type: text_font_size:FontSizeSpec(String, Dict(String, Either(String, Instance(Transform), List(String))), List(String))

The text font size values for the text.

text_font_style

property type: text_font_style:Enum(‘normal’, ‘italic’, ‘bold’)

The text font style values for the text.

x

property type: x:Float

The x-coordinate in screen coordinates to locate the text anchors.

x_offset

property type: x_offset:Float

Offset value to apply to the x-coordinate.

This is useful, for instance, if it is desired to “float” text a fixed distance in screen units from a given data position.

x_range_name

property type: x_range_name:String

A particular (named) x-range to use for computing screen location when rendering an annotation on the plot. If unset, use the default x-range.

x_units

property type: x_units:Enum(‘screen’, ‘data’)

The unit type for the x attribute. Interpreted as “data space” units by default.

y

property type: y:Float

The y-coordinate in screen coordinates to locate the text anchors.

y_offset

property type: y_offset:Float

Offset value to apply to the y-coordinate.

This is useful, for instance, if it is desired to “float” text a fixed distance in screen units from a given data position.

y_range_name

property type: y_range_name:String

A particular (named) y-range to use for computing screen location when rendering an annotation on the plot. If unset, use the default y-range.

y_units

property type: y_units:Enum(‘screen’, ‘data’)

The unit type for the y attribute. Interpreted as “data space” units by default.

JSON Prototype
{
  "angle": 0,
  "angle_units": "rad",
  "background_fill_alpha": {
    "value": 1.0
  },
  "background_fill_color": {
    "value": null
  },
  "border_line_alpha": {
    "value": 1.0
  },
  "border_line_cap": "butt",
  "border_line_color": {
    "value": null
  },
  "border_line_dash": [],
  "border_line_dash_offset": 0,
  "border_line_join": "miter",
  "border_line_width": {
    "value": 1
  },
  "id": "ab0620bd-89dc-47e1-93be-41b72ff672c3",
  "level": "annotation",
  "name": null,
  "plot": null,
  "render_mode": "canvas",
  "tags": [],
  "text": null,
  "text_align": "left",
  "text_alpha": {
    "value": 1.0
  },
  "text_baseline": "bottom",
  "text_color": {
    "value": "#444444"
  },
  "text_font": "helvetica",
  "text_font_size": {
    "value": "12pt"
  },
  "text_font_style": "normal",
  "visible": true,
  "x": null,
  "x_offset": 0,
  "x_range_name": "default",
  "x_units": "data",
  "y": null,
  "y_offset": 0,
  "y_range_name": "default",
  "y_units": "data"
}
class LabelSet(**kwargs)

Bases: bokeh.models.annotations.TextAnnotation

Render a group of text boxes as annotations.

angle

property type: angle:AngleSpec(units_default=’rad’)

The angles to rotate the text, as measured from the horizontal.

Warning

The center of rotation for canvas and css render_modes is different. For render_mode=”canvas” the label is rotated from the top-left corner of the annotation, while for render_mode=”css” the annotation is rotated around it’s center.

angle_units

property type: angle_units:Enum(‘deg’, ‘rad’)

background_fill_alpha

property type: background_fill_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The fill alpha values for the text bounding box.

background_fill_color

property type: background_fill_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The fill color values for the text bounding box.

border_line_alpha

property type: border_line_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line alpha values for the text bounding box.

border_line_cap

property type: border_line_cap:Enum(‘butt’, ‘round’, ‘square’)

The line cap values for the text bounding box.

border_line_color

property type: border_line_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The line color values for the text bounding box.

border_line_dash

property type: border_line_dash:DashPattern

The line dash values for the text bounding box.

border_line_dash_offset

property type: border_line_dash_offset:Int

The line dash offset values for the text bounding box.

border_line_join

property type: border_line_join:Enum(‘miter’, ‘round’, ‘bevel’)

The line join values for the text bounding box.

border_line_width

property type: border_line_width:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line width values for the text bounding box.

render_mode

property type: render_mode:Enum(‘canvas’, ‘css’)

Specifies whether the text is rendered as a canvas element or as an css element overlaid on the canvas. The default mode is “canvas”.

Note

The CSS labels won’t be present in the output using the “save” tool.

Warning

Not all visual styling properties are supported if the render_mode is set to “css”. The border_line_dash property isn’t fully supported and border_line_dash_offset isn’t supported at all. Setting text_alpha will modify the opacity of the entire background box and border in addition to the text. Finally, clipping Label annotations inside of the plot area isn’t supported in “css” mode.

source

property type: source:Instance(DataSource)

Local data source to use when rendering annotations on the plot.

text

property type: text:StringSpec(String, Dict(String, Either(String, Instance(Transform), List(String))), List(String))

The text values to render.

text_align

property type: text_align:Enum(‘left’, ‘right’, ‘center’)

The text align values for the text.

text_alpha

property type: text_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The text alpha values for the text.

text_baseline

property type: text_baseline:Enum(‘top’, ‘middle’, ‘bottom’, ‘alphabetic’, ‘hanging’, ‘ideographic’)

The text baseline values for the text.

text_color

property type: text_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The text color values for the text.

text_font

property type: text_font:String

The text font values for the text.

text_font_size

property type: text_font_size:FontSizeSpec(String, Dict(String, Either(String, Instance(Transform), List(String))), List(String))

The text font size values for the text.

text_font_style

property type: text_font_style:Enum(‘normal’, ‘italic’, ‘bold’)

The text font style values for the text.

x

property type: x:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The x-coordinates to locate the text anchors.

x_offset

property type: x_offset:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

Offset values to apply to the x-coordinates.

This is useful, for instance, if it is desired to “float” text a fixed distance in screen units from a given data position.

x_range_name

property type: x_range_name:String

A particular (named) x-range to use for computing screen locations when rendering annotations on the plot. If unset, use the default x-range.

x_units

property type: x_units:Enum(‘screen’, ‘data’)

The unit type for the xs attribute. Interpreted as “data space” units by default.

y

property type: y:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The y-coordinates to locate the text anchors.

y_offset

property type: y_offset:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

Offset values to apply to the y-coordinates.

This is useful, for instance, if it is desired to “float” text a fixed distance in screen units from a given data position.

y_range_name

property type: y_range_name:String

A particular (named) y-range to use for computing screen locations when rendering annotations on the plot. If unset, use the default y-range.

y_units

property type: y_units:Enum(‘screen’, ‘data’)

The unit type for the ys attribute. Interpreted as “data space” units by default.

JSON Prototype
{
  "angle": {
    "units": "rad",
    "value": 0
  },
  "background_fill_alpha": {
    "value": 1.0
  },
  "background_fill_color": {
    "value": null
  },
  "border_line_alpha": {
    "value": 1.0
  },
  "border_line_cap": "butt",
  "border_line_color": {
    "value": null
  },
  "border_line_dash": [],
  "border_line_dash_offset": 0,
  "border_line_join": "miter",
  "border_line_width": {
    "value": 1
  },
  "id": "ca83d386-077e-427a-bad7-5c5f1632ea51",
  "level": "annotation",
  "name": null,
  "plot": null,
  "render_mode": "canvas",
  "source": {
    "id": "af3589c1-ee1a-4900-8472-84cf6f974a9e",
    "type": "ColumnDataSource"
  },
  "tags": [],
  "text": {
    "field": "text"
  },
  "text_align": "left",
  "text_alpha": {
    "value": 1.0
  },
  "text_baseline": "bottom",
  "text_color": {
    "value": "#444444"
  },
  "text_font": "helvetica",
  "text_font_size": {
    "value": "12pt"
  },
  "text_font_style": "normal",
  "visible": true,
  "x": null,
  "x_offset": {
    "value": 0
  },
  "x_range_name": "default",
  "x_units": "data",
  "y": null,
  "y_offset": {
    "value": 0
  },
  "y_range_name": "default",
  "y_units": "data"
}
class Legend(**kwargs)

Bases: bokeh.models.annotations.Annotation

Render informational legends for a plot.

background_fill_alpha

property type: background_fill_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The fill alpha for the legend background style.

background_fill_color

property type: background_fill_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The fill color for the legend background style.

border_line_alpha

property type: border_line_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line alpha for the legend border outline.

border_line_cap

property type: border_line_cap:Enum(‘butt’, ‘round’, ‘square’)

The line cap for the legend border outline.

border_line_color

property type: border_line_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The line color for the legend border outline.

border_line_dash

property type: border_line_dash:DashPattern

The line dash for the legend border outline.

border_line_dash_offset

property type: border_line_dash_offset:Int

The line dash offset for the legend border outline.

border_line_join

property type: border_line_join:Enum(‘miter’, ‘round’, ‘bevel’)

The line join for the legend border outline.

border_line_width

property type: border_line_width:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line width for the legend border outline.

glyph_height

property type: glyph_height:Int

The height (in pixels) that the rendered legend glyph should occupy.

glyph_width

property type: glyph_width:Int

The width (in pixels) that the rendered legend glyph should occupy.

label_height

property type: label_height:Int

The minimum height (in pixels) of the area that legend labels should occupy.

label_standoff

property type: label_standoff:Int

The distance (in pixels) to separate the label from its associated glyph.

label_text_align

property type: label_text_align:Enum(‘left’, ‘right’, ‘center’)

The text align for the legend labels.

label_text_alpha

property type: label_text_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The text alpha for the legend labels.

label_text_baseline

property type: label_text_baseline:Enum(‘top’, ‘middle’, ‘bottom’, ‘alphabetic’, ‘hanging’, ‘ideographic’)

The text baseline for the legend labels.

label_text_color

property type: label_text_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The text color for the legend labels.

label_text_font

property type: label_text_font:String

The text font for the legend labels.

label_text_font_size

property type: label_text_font_size:FontSizeSpec(String, Dict(String, Either(String, Instance(Transform), List(String))), List(String))

The text font size for the legend labels.

label_text_font_style

property type: label_text_font_style:Enum(‘normal’, ‘italic’, ‘bold’)

The text font style for the legend labels.

label_width

property type: label_width:Int

The minimum width (in pixels) of the area that legend labels should occupy.

legend_margin

property type: legend_margin:Int

Amount of margin around the legend.

legend_padding

property type: legend_padding:Int

Amount of padding around the contents of the legend.

legend_spacing

property type: legend_spacing:Int

Amount of spacing between legend entries.

legends

property type: legends:List(Tuple(String, List(Instance(GlyphRenderer))))

A list of tuples that maps text labels to the legend to corresponding renderers that should draw sample representations for those labels.

Note

The legends attribute may also be set from a dict or OrderedDict. If a dict is used, the order of the legend entries is unspecified.

location

property type: location:Either(Enum(‘top_left’, ‘top_center’, ‘top_right’, ‘right_center’, ‘bottom_right’, ‘bottom_center’, ‘bottom_left’, ‘left_center’, ‘center’), Tuple(Float, Float))

The location where the legend should draw itself. It’s either one of bokeh.core.enums.LegendLocation‘s enumerated values, or a (x, y) tuple indicating an absolute location absolute location in screen coordinates (pixels from the bottom-left corner).

orientation

property type: orientation:Enum(‘horizontal’, ‘vertical’)

Whether the legend entries should be placed vertically or horizontally when they are layed out.

JSON Prototype
{
  "background_fill_alpha": {
    "value": 0.95
  },
  "background_fill_color": {
    "value": "#ffffff"
  },
  "border_line_alpha": {
    "value": 0.5
  },
  "border_line_cap": "butt",
  "border_line_color": {
    "value": "#e5e5e5"
  },
  "border_line_dash": [],
  "border_line_dash_offset": 0,
  "border_line_join": "miter",
  "border_line_width": {
    "value": 1
  },
  "glyph_height": 20,
  "glyph_width": 20,
  "id": "5f94d511-164c-46e5-a81b-2359c5f290b7",
  "label_height": 20,
  "label_standoff": 5,
  "label_text_align": "left",
  "label_text_alpha": {
    "value": 1.0
  },
  "label_text_baseline": "middle",
  "label_text_color": {
    "value": "#444444"
  },
  "label_text_font": "helvetica",
  "label_text_font_size": {
    "value": "10pt"
  },
  "label_text_font_style": "normal",
  "label_width": 20,
  "legend_margin": 10,
  "legend_padding": 10,
  "legend_spacing": 3,
  "legends": [],
  "level": "annotation",
  "location": "top_right",
  "name": null,
  "orientation": "vertical",
  "plot": null,
  "tags": [],
  "visible": true
}
class PolyAnnotation(**kwargs)

Bases: bokeh.models.annotations.Annotation

Render a shaded polygonal region as an annotation.

fill_alpha

property type: fill_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The fill alpha values for the polygon.

fill_color

property type: fill_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The fill color values for the polygon.

line_alpha

property type: line_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line alpha values for the polygon.

line_cap

property type: line_cap:Enum(‘butt’, ‘round’, ‘square’)

The line cap values for the polygon.

line_color

property type: line_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The line color values for the polygon.

line_dash

property type: line_dash:DashPattern

The line dash values for the polygon.

line_dash_offset

property type: line_dash_offset:Int

The line dash offset values for the polygon.

line_join

property type: line_join:Enum(‘miter’, ‘round’, ‘bevel’)

The line join values for the polygon.

line_width

property type: line_width:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line width values for the polygon.

x_range_name

property type: x_range_name:String

A particular (named) x-range to use for computing screen locations when rendering box annotations on the plot. If unset, use the default x-range.

xs

property type: xs:Seq(Float)

The x-coordinates of the region to draw.

xs_units

property type: xs_units:Enum(‘screen’, ‘data’)

The unit type for the xs attribute. Interpreted as “data space” units by default.

y_range_name

property type: y_range_name:String

A particular (named) y-range to use for computing screen locations when rendering box annotations on the plot. If unset, use the default y-range.

ys

property type: ys:Seq(Float)

The y-coordinates of the region to draw.

ys_units

property type: ys_units:Enum(‘screen’, ‘data’)

The unit type for the ys attribute. Interpreted as “data space” units by default.

JSON Prototype
{
  "fill_alpha": {
    "value": 0.4
  },
  "fill_color": {
    "value": "#fff9ba"
  },
  "id": "a49af889-0948-4450-8837-23ac2ec23d77",
  "level": "annotation",
  "line_alpha": {
    "value": 0.3
  },
  "line_cap": "butt",
  "line_color": {
    "value": "#cccccc"
  },
  "line_dash": [],
  "line_dash_offset": 0,
  "line_join": "miter",
  "line_width": {
    "value": 1
  },
  "name": null,
  "plot": null,
  "tags": [],
  "visible": true,
  "x_range_name": "default",
  "xs": [],
  "xs_units": "data",
  "y_range_name": "default",
  "ys": [],
  "ys_units": "data"
}
class Span(**kwargs)

Bases: bokeh.models.annotations.Annotation

Render a horizontal or vertical line span.

dimension

property type: dimension:Enum(‘width’, ‘height’, ‘x’, ‘y’)

The direction of the span.

line_alpha

property type: line_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line alpha values for the span.

line_cap

property type: line_cap:Enum(‘butt’, ‘round’, ‘square’)

The line cap values for the span.

line_color

property type: line_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The line color values for the span.

line_dash

property type: line_dash:DashPattern

The line dash values for the span.

line_dash_offset

property type: line_dash_offset:Int

The line dash offset values for the span.

line_join

property type: line_join:Enum(‘miter’, ‘round’, ‘bevel’)

The line join values for the span.

line_width

property type: line_width:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line width values for the span.

location

property type: location:Float

The location of the span, along dimension.

location_units

property type: location_units:Enum(‘screen’, ‘data’)

The unit type for the location attribute. Interpreted as “data space” units by default.

render_mode

property type: render_mode:Enum(‘canvas’, ‘css’)

Specifies whether the span is rendered as a canvas element or as an css element overlaid on the canvas. The default mode is “canvas”.

Warning

The line_dash and line_dash_offset attributes aren’t supported if the render_mode is set to “css”

x_range_name

property type: x_range_name:String

A particular (named) x-range to use for computing screen locations when rendering annotations on the plot. If unset, use the default x-range.

y_range_name

property type: y_range_name:String

A particular (named) y-range to use for computing screen locations when rendering annotations on the plot. If unset, use the default y-range.

JSON Prototype
{
  "dimension": "width",
  "id": "1dd7ced2-0d4a-4ba8-ad98-9124882e8a13",
  "level": "annotation",
  "line_alpha": {
    "value": 1.0
  },
  "line_cap": "butt",
  "line_color": {
    "value": "black"
  },
  "line_dash": [],
  "line_dash_offset": 0,
  "line_join": "miter",
  "line_width": {
    "value": 1
  },
  "location": null,
  "location_units": "data",
  "name": null,
  "plot": null,
  "render_mode": "canvas",
  "tags": [],
  "visible": true,
  "x_range_name": "default",
  "y_range_name": "default"
}
class TextAnnotation(**kwargs)

Bases: bokeh.models.annotations.Annotation

Base class for annotation models.

JSON Prototype
{
  "id": "b930835a-9ae0-4421-838a-552262e73391",
  "level": "annotation",
  "name": null,
  "plot": null,
  "tags": [],
  "visible": true
}
class Title(**kwargs)

Bases: bokeh.models.annotations.TextAnnotation

Render a single title box as an annotation.

align

property type: align:Enum(‘left’, ‘right’, ‘center’)

Location to align the title text.

background_fill_alpha

property type: background_fill_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The fill alpha values for the text bounding box.

background_fill_color

property type: background_fill_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The fill color values for the text bounding box.

border_line_alpha

property type: border_line_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line alpha values for the text bounding box.

border_line_cap

property type: border_line_cap:Enum(‘butt’, ‘round’, ‘square’)

The line cap values for the text bounding box.

border_line_color

property type: border_line_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

The line color values for the text bounding box.

border_line_dash

property type: border_line_dash:DashPattern

The line dash values for the text bounding box.

border_line_dash_offset

property type: border_line_dash_offset:Int

The line dash offset values for the text bounding box.

border_line_join

property type: border_line_join:Enum(‘miter’, ‘round’, ‘bevel’)

The line join values for the text bounding box.

border_line_width

property type: border_line_width:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

The line width values for the text bounding box.

offset

property type: offset:Float

Offset the text by a number of pixels (can be positive or negative). Shifts the text in different directions based on the location of the title:

  • above: shifts title right
  • right: shifts title down
  • below: shifts title right
  • left: shifts title up
render_mode

property type: render_mode:Enum(‘canvas’, ‘css’)

Specifies whether the text is rendered as a canvas element or as an css element overlaid on the canvas. The default mode is “canvas”.

Note

The CSS labels won’t be present in the output using the “save” tool.

Warning

Not all visual styling properties are supported if the render_mode is set to “css”. The border_line_dash property isn’t fully supported and border_line_dash_offset isn’t supported at all. Setting text_alpha will modify the opacity of the entire background box and border in addition to the text. Finally, clipping Label annotations inside of the plot area isn’t supported in “css” mode.

text

property type: text:String

The text value to render.

text_alpha

property type: text_alpha:NumberSpec(String, Dict(String, Either(String, Instance(Transform), Float)), Float)

An alpha value to use to fill text with.

Acceptable values are floating point numbers between 0 (transparent) and 1 (opaque).

text_color

property type: text_color:ColorSpec(String, Dict(String, Either(String, Instance(Transform), Color)), Color)

A color to use to fill text with.

Acceptable values are:

  • any of the 147 named CSS colors, e.g 'green', 'indigo'
  • an RGB(A) hex value, e.g., '#FF0000', '#44444444'
  • a 3-tuple of integers (r,g,b) between 0 and 255
  • a 4-tuple of (r,g,b,a) where r,g,b are integers between 0..255 and a is between 0..1
text_font

property type: text_font:String

Name of a font to use for rendering text, e.g., 'times', 'helvetica'.

text_font_size

property type: text_font_size:FontSizeSpec(String, Dict(String, Either(String, Instance(Transform), List(String))), List(String))

text_font_style

property type: text_font_style:Enum(‘normal’, ‘italic’, ‘bold’)

A style to use for rendering text.

Acceptable values are:

  • 'normal' normal text
  • 'italic' italic text
  • 'bold' bold text
JSON Prototype
{
  "align": "left",
  "background_fill_alpha": {
    "value": 1.0
  },
  "background_fill_color": {
    "value": null
  },
  "border_line_alpha": {
    "value": 1.0
  },
  "border_line_cap": "butt",
  "border_line_color": {
    "value": null
  },
  "border_line_dash": [],
  "border_line_dash_offset": 0,
  "border_line_join": "miter",
  "border_line_width": {
    "value": 1
  },
  "id": "e3ffc905-a8c3-4961-8c96-266f4f384800",
  "level": "annotation",
  "name": null,
  "offset": 0,
  "plot": null,
  "render_mode": "canvas",
  "tags": [],
  "text": null,
  "text_alpha": {
    "value": 1.0
  },
  "text_color": {
    "value": "#444444"
  },
  "text_font": "helvetica",
  "text_font_size": {
    "value": "10pt"
  },
  "text_font_style": "bold",
  "visible": true
}
class Tooltip(**kwargs)

Bases: bokeh.models.annotations.Annotation

Render a tooltip.

Note

This model is currently managed by BokehJS and is not useful directly from python.

attachment

property type: attachment:Enum(‘horizontal’, ‘vertical’, ‘left’, ‘right’, ‘above’, ‘below’)

Whether the tooltip should display to the left or right off the cursor position or above or below it, or if it should be automatically placed in the horizontal or vertical dimension.

inner_only

property type: inner_only:Bool

Whether to display outside a central plot frame area.

JSON Prototype
{
  "attachment": "horizontal",
  "id": "eb939783-2dce-4a0d-a311-6d4a461b015b",
  "inner_only": true,
  "level": "overlay",
  "name": null,
  "plot": null,
  "tags": [],
  "visible": true
}