bokeh.models.annotations

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

class Annotation(**kwargs)[source]

Bases: bokeh.models.renderers.Renderer

Base class for all annotation models.

Note

This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.

plot

property type: Instance ( Plot )

The plot to which this annotation is attached.

JSON Prototype
{
  "id": "d385acc5-02cb-45fd-abe5-75cecb28aeb2",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "annotation",
  "name": null,
  "plot": null,
  "subscribed_events": [],
  "tags": [],
  "visible": true
}
class Arrow(**kwargs)[source]

Bases: bokeh.models.annotations.Annotation

Render an arrow as an annotation.

end

property type: Instance ( ArrowHead )

Instance of ArrowHead.

end_units

property type: Enum ( SpatialUnits )

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

line_alpha

property type: NumberSpec

The line alpha values for the arrow body.

line_cap

property type: Enum ( LineCap )

The line cap values for the arrow body.

line_color

property type: ColorSpec

The line color values for the arrow body.

line_dash

property type: DashPattern

The line dash values for the arrow body.

line_dash_offset

property type: Int

The line dash offset values for the arrow body.

line_join

property type: Enum ( LineJoin )

The line join values for the arrow body.

line_width

property type: NumberSpec

The line width values for the arrow body.

source

property type: Instance ( DataSource )

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

start

property type: Instance ( ArrowHead )

Instance of ArrowHead.

start_units

property type: Enum ( SpatialUnits )

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

x_end

property type: NumberSpec

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

x_range_name

property type: 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: NumberSpec

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

y_end

property type: NumberSpec

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

y_range_name

property type: 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: NumberSpec

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

JSON Prototype
{
  "end": {
    "id": "98f00aae-8867-428a-92ce-74b4d1375849",
    "type": "OpenHead"
  },
  "end_units": "data",
  "id": "bd0010dd-71aa-4148-ab91-30437b5eb4ca",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "annotation",
  "line_alpha": {
    "value": 1.0
  },
  "line_cap": "butt",
  "line_color": {
    "value": "black"
  },
  "line_dash": [],
  "line_dash_offset": 0,
  "line_join": "bevel",
  "line_width": {
    "value": 1
  },
  "name": null,
  "plot": null,
  "source": null,
  "start": null,
  "start_units": "data",
  "subscribed_events": [],
  "tags": [],
  "visible": true,
  "x_end": null,
  "x_range_name": "default",
  "x_start": null,
  "y_end": null,
  "y_range_name": "default",
  "y_start": null
}
class Band(**kwargs)[source]

Bases: bokeh.models.annotations.Annotation

Render a filled area band along a dimension.

base

property type: DistanceSpec

The orthogonal coordinates of the upper and lower values.

base_units

property type: Enum ( SpatialUnits )

dimension

property type: Enum ( Dimension )

The direction of the band.

fill_alpha

property type: NumberSpec

The fill alpha values for the band.

fill_color

property type: ColorSpec

The fill color values for the band.

line_alpha

property type: NumberSpec

The line alpha values for the band.

line_cap

property type: Enum ( LineCap )

The line cap values for the band.

line_color

property type: ColorSpec

The line color values for the band.

line_dash

property type: DashPattern

The line dash values for the band.

line_dash_offset

property type: Int

The line dash offset values for the band.

line_join

property type: Enum ( LineJoin )

The line join values for the band.

line_width

property type: NumberSpec

The line width values for the band.

lower

property type: DistanceSpec

The coordinates of the lower portion of the filled area band.

lower_units

property type: Enum ( SpatialUnits )

source

property type: Instance ( DataSource )

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

upper

property type: DistanceSpec

The coordinations of the upper portion of the filled area band.

upper_units

property type: Enum ( SpatialUnits )

x_range_name

property type: 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: 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
{
  "base": null,
  "dimension": "height",
  "fill_alpha": {
    "value": 0.4
  },
  "fill_color": {
    "value": "#fff9ba"
  },
  "id": "4209b4f1-97dd-4c77-9996-6c20b3c0bb7e",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "annotation",
  "line_alpha": {
    "value": 0.3
  },
  "line_cap": "butt",
  "line_color": {
    "value": "#cccccc"
  },
  "line_dash": [],
  "line_dash_offset": 0,
  "line_join": "bevel",
  "line_width": {
    "value": 1
  },
  "lower": null,
  "name": null,
  "plot": null,
  "source": {
    "id": "272d132e-cf2e-4ce7-b2d5-496c313936e0",
    "type": "ColumnDataSource"
  },
  "subscribed_events": [],
  "tags": [],
  "upper": null,
  "visible": true,
  "x_range_name": "default",
  "y_range_name": "default"
}
class BoxAnnotation(**kwargs)[source]

Bases: bokeh.models.annotations.Annotation

Render a shaded rectangular region as an annotation.

bottom

property type: Either ( Auto , NumberSpec )

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

Datetime values are also accepted, but note that they are immediately converted to milliseconds-since-epoch.

bottom_units

property type: Enum ( SpatialUnits )

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

fill_alpha

property type: NumberSpec

The fill alpha values for the box.

fill_color

property type: ColorSpec

The fill color values for the box.

left

property type: Either ( Auto , NumberSpec )

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

Datetime values are also accepted, but note that they are immediately converted to milliseconds-since-epoch.

left_units

property type: Enum ( SpatialUnits )

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

line_alpha

property type: NumberSpec

The line alpha values for the box.

line_cap

property type: Enum ( LineCap )

The line cap values for the box.

line_color

property type: ColorSpec

The line color values for the box.

line_dash

property type: DashPattern

The line dash values for the box.

line_dash_offset

property type: Int

The line dash offset values for the box.

line_join

property type: Enum ( LineJoin )

The line join values for the box.

line_width

property type: NumberSpec

The line width values for the box.

render_mode

property type: Enum ( RenderMode )

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: Either ( Auto , NumberSpec )

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

Datetime values are also accepted, but note that they are immediately converted to milliseconds-since-epoch.

right_units

property type: Enum ( SpatialUnits )

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

top

property type: Either ( Auto , NumberSpec )

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

Datetime values are also accepted, but note that they are immediately converted to milliseconds-since-epoch.

top_units

property type: Enum ( SpatialUnits )

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

x_range_name

property type: 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: 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": "2a46f2e3-1e74-484c-b30a-792079e9472e",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "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": "bevel",
  "line_width": {
    "value": 1
  },
  "name": null,
  "plot": null,
  "render_mode": "canvas",
  "right": null,
  "right_units": "data",
  "subscribed_events": [],
  "tags": [],
  "top": null,
  "top_units": "data",
  "visible": true,
  "x_range_name": "default",
  "y_range_name": "default"
}
class ColorBar(**kwargs)[source]

Bases: bokeh.models.annotations.Annotation

Render a color bar based on a color mapper.

background_fill_alpha

property type: NumberSpec

The fill alpha for the color bar background style.

background_fill_color

property type: ColorSpec

The fill color for the color bar background style.

bar_line_alpha

property type: NumberSpec

The line alpha for the color scale bar outline.

bar_line_cap

property type: Enum ( LineCap )

The line cap for the color scale bar outline.

bar_line_color

property type: ColorSpec

The line color for the color scale bar outline.

bar_line_dash

property type: DashPattern

The line dash for the color scale bar outline.

bar_line_dash_offset

property type: Int

The line dash offset for the color scale bar outline.

bar_line_join

property type: Enum ( LineJoin )

The line join for the color scale bar outline.

bar_line_width

property type: NumberSpec

The line width for the color scale bar outline.

border_line_alpha

property type: NumberSpec

The line alpha for the color bar border outline.

border_line_cap

property type: Enum ( LineCap )

The line cap for the color bar border outline.

border_line_color

property type: ColorSpec

The line color for the color bar border outline.

border_line_dash

property type: DashPattern

The line dash for the color bar border outline.

border_line_dash_offset

property type: Int

The line dash offset for the color bar border outline.

border_line_join

property type: Enum ( LineJoin )

The line join for the color bar border outline.

border_line_width

property type: NumberSpec

The line width for the color bar border outline.

color_mapper

property type: Instance ( ContinuousColorMapper )

A continuous color mapper containing a color palette to render.

Warning

If the low and high attributes of the ColorMapper aren’t set, ticks and tick labels won’t be rendered. Additionally, if a LogTicker is passed to the ticker argument and either or both of the logarithms of low and high values of the color_mapper are non-numeric (i.e. low=0), the tick and tick labels won’t be rendered.

formatter

property type: Instance ( TickFormatter )

A TickFormatter to use for formatting the visual appearance of ticks.

height

property type: Either ( Auto , Int )

The height (in pixels) that the color scale should occupy.

label_standoff

property type: Int

The distance (in pixels) to separate the tick labels from the color bar.

location

property type: Either ( Enum ( Anchor ), Tuple ( Float , Float ) )

The location where the color bar 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).

Warning

If the color bar is placed in a side panel, the location will likely have to be set to (0,0).

major_label_overrides

property type: Dict ( Either ( Float , String ), String )

Provide explicit tick label values for specific tick locations that override normal formatting.

major_label_text_align

property type: Enum ( TextAlign )

The text align of the major tick labels.

major_label_text_alpha

property type: NumberSpec

The text alpha of the major tick labels.

major_label_text_baseline

property type: Enum ( TextBaseline )

The text baseline of the major tick labels.

major_label_text_color

property type: ColorSpec

The text color of the major tick labels.

major_label_text_font

property type: String

The text font of the major tick labels.

major_label_text_font_size

property type: FontSizeSpec

The text font size of the major tick labels.

major_label_text_font_style

property type: Enum ( FontStyle )

The text font style of the major tick labels.

major_label_text_line_height

property type: Float

The text line height of the major tick labels.

major_tick_in

property type: Int

The distance (in pixels) that major ticks should extend into the main plot area.

major_tick_line_alpha

property type: NumberSpec

The line alpha of the major ticks.

major_tick_line_cap

property type: Enum ( LineCap )

The line cap of the major ticks.

major_tick_line_color

property type: ColorSpec

The line color of the major ticks.

major_tick_line_dash

property type: DashPattern

The line dash of the major ticks.

major_tick_line_dash_offset

property type: Int

The line dash offset of the major ticks.

major_tick_line_join

property type: Enum ( LineJoin )

The line join of the major ticks.

major_tick_line_width

property type: NumberSpec

The line width of the major ticks.

major_tick_out

property type: Int

The distance (in pixels) that major ticks should extend out of the main plot area.

margin

property type: Int

Amount of margin (in pixels) around the outside of the color bar.

minor_tick_in

property type: Int

The distance (in pixels) that minor ticks should extend into the main plot area.

minor_tick_line_alpha

property type: NumberSpec

The line alpha of the minor ticks.

minor_tick_line_cap

property type: Enum ( LineCap )

The line cap of the minor ticks.

minor_tick_line_color

property type: ColorSpec

The line color of the minor ticks.

minor_tick_line_dash

property type: DashPattern

The line dash of the minor ticks.

minor_tick_line_dash_offset

property type: Int

The line dash offset of the minor ticks.

minor_tick_line_join

property type: Enum ( LineJoin )

The line join of the minor ticks.

minor_tick_line_width

property type: NumberSpec

The line width of the minor ticks.

minor_tick_out

property type: Int

The distance (in pixels) that major ticks should extend out of the main plot area.

orientation

property type: Enum ( Orientation )

Whether the color bar should be oriented vertically or horizontally.

padding

property type: Int

Amount of padding (in pixels) between the color scale and color bar border.

scale_alpha

property type: Float

The alpha with which to render the color scale.

ticker

property type: Instance ( ContinuousTicker )

A Ticker to use for computing locations of axis components.

title

property type: String

The title text to render.

title_standoff

property type: Int

The distance (in pixels) to separate the title from the color bar.

title_text_align

property type: Enum ( TextAlign )

The text align values for the title text.

title_text_alpha

property type: NumberSpec

The text alpha values for the title text.

title_text_baseline

property type: Enum ( TextBaseline )

The text baseline values for the title text.

title_text_color

property type: ColorSpec

The text color values for the title text.

title_text_font

property type: String

The text font values for the title text.

title_text_font_size

property type: FontSizeSpec

The text font size values for the title text.

title_text_font_style

property type: Enum ( FontStyle )

The text font style values for the title text.

title_text_line_height

property type: Float

The text line height values for the title text.

width

property type: Either ( Auto , Int )

The width (in pixels) that the color scale should occupy.

JSON Prototype
{
  "background_fill_alpha": {
    "value": 0.95
  },
  "background_fill_color": {
    "value": "#ffffff"
  },
  "bar_line_alpha": {
    "value": 1.0
  },
  "bar_line_cap": "butt",
  "bar_line_color": {
    "value": null
  },
  "bar_line_dash": [],
  "bar_line_dash_offset": 0,
  "bar_line_join": "bevel",
  "bar_line_width": {
    "value": 1
  },
  "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": "bevel",
  "border_line_width": {
    "value": 1
  },
  "color_mapper": null,
  "formatter": {
    "id": "a7a3a040-1b52-4c13-9a65-bff432b5872e",
    "type": "BasicTickFormatter"
  },
  "height": "auto",
  "id": "8ec36356-c7c0-4f02-a7aa-48a7fb9ea051",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "label_standoff": 5,
  "level": "annotation",
  "location": "top_right",
  "major_label_overrides": {},
  "major_label_text_align": "center",
  "major_label_text_alpha": {
    "value": 1.0
  },
  "major_label_text_baseline": "middle",
  "major_label_text_color": {
    "value": "#444444"
  },
  "major_label_text_font": "helvetica",
  "major_label_text_font_size": {
    "value": "8pt"
  },
  "major_label_text_font_style": "normal",
  "major_label_text_line_height": 1.2,
  "major_tick_in": 5,
  "major_tick_line_alpha": {
    "value": 1.0
  },
  "major_tick_line_cap": "butt",
  "major_tick_line_color": {
    "value": "#ffffff"
  },
  "major_tick_line_dash": [],
  "major_tick_line_dash_offset": 0,
  "major_tick_line_join": "bevel",
  "major_tick_line_width": {
    "value": 1
  },
  "major_tick_out": 0,
  "margin": 30,
  "minor_tick_in": 0,
  "minor_tick_line_alpha": {
    "value": 1.0
  },
  "minor_tick_line_cap": "butt",
  "minor_tick_line_color": {
    "value": null
  },
  "minor_tick_line_dash": [],
  "minor_tick_line_dash_offset": 0,
  "minor_tick_line_join": "bevel",
  "minor_tick_line_width": {
    "value": 1
  },
  "minor_tick_out": 0,
  "name": null,
  "orientation": "vertical",
  "padding": 10,
  "plot": null,
  "scale_alpha": 1.0,
  "subscribed_events": [],
  "tags": [],
  "ticker": {
    "id": "489096c9-f8e3-47dd-a4bc-3df786245f7c",
    "type": "BasicTicker"
  },
  "title": null,
  "title_standoff": 2,
  "title_text_align": "left",
  "title_text_alpha": {
    "value": 1.0
  },
  "title_text_baseline": "bottom",
  "title_text_color": {
    "value": "#444444"
  },
  "title_text_font": "helvetica",
  "title_text_font_size": {
    "value": "10pt"
  },
  "title_text_font_style": "italic",
  "title_text_line_height": 1.2,
  "visible": true,
  "width": "auto"
}
class Label(**kwargs)[source]

Bases: bokeh.models.annotations.TextAnnotation

Render a single text label as an annotation.

Label will render a single text label at given x and y coordinates, which can be in either screen (pixel) space, or data (axis range) space.

The label can also be configured with a screen space offset from x and y, by using the x_offset and y_offset properties.

Additionally, the label can be rotated with the angle property.

There are also standard text, fill, and line properties to control the appearance of the text, its background, as well as the rectangular bounding box border.

angle

property type: 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: Enum ( AngleUnits )

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

background_fill_alpha

property type: NumberSpec

The fill alpha values for the text bounding box.

background_fill_color

property type: ColorSpec

The fill color values for the text bounding box.

border_line_alpha

property type: NumberSpec

The line alpha values for the text bounding box.

border_line_cap

property type: Enum ( LineCap )

The line cap values for the text bounding box.

border_line_color

property type: ColorSpec

The line color values for the text bounding box.

border_line_dash

property type: DashPattern

The line dash values for the text bounding box.

border_line_dash_offset

property type: Int

The line dash offset values for the text bounding box.

border_line_join

property type: Enum ( LineJoin )

The line join values for the text bounding box.

border_line_width

property type: NumberSpec

The line width values for the text bounding box.

text

property type: String

The text value to render.

text_align

property type: Enum ( TextAlign )

The text align values for the text.

text_alpha

property type: NumberSpec

The text alpha values for the text.

text_baseline

property type: Enum ( TextBaseline )

The text baseline values for the text.

text_color

property type: ColorSpec

The text color values for the text.

text_font

property type: String

The text font values for the text.

text_font_size

property type: FontSizeSpec

The text font size values for the text.

text_font_style

property type: Enum ( FontStyle )

The text font style values for the text.

text_line_height

property type: Float

The text line height values for the text.

x

property type: Float

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

Datetime values are also accepted, but note that they are immediately converted to milliseconds-since-epoch.

x_offset

property type: 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: 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: Enum ( SpatialUnits )

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

y

property type: Float

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

Datetime values are also accepted, but note that they are immediately converted to milliseconds-since-epoch.

y_offset

property type: 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: 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: Enum ( SpatialUnits )

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": "bevel",
  "border_line_width": {
    "value": 1
  },
  "id": "6eeb6fa1-45d9-4c2a-a5e9-a0b12225486e",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "annotation",
  "name": null,
  "plot": null,
  "render_mode": "canvas",
  "subscribed_events": [],
  "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",
  "text_line_height": 1.2,
  "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)[source]

Bases: bokeh.models.annotations.TextAnnotation

Render multiple text labels as annotations.

LabelSet will render multiple text labels at given x and y coordinates, which can be in either screen (pixel) space, or data (axis range) space. In this case (as opposed to the single Label model), x and y can also be the name of a column from a ColumnDataSource, in which case the labels will be “vectorized” using coordinate values from the specified columns.

The label can also be configured with a screen space offset from x and y, by using the x_offset and y_offset properties. These offsets may be vectorized by giving the name of a data source column.

Additionally, the label can be rotated with the angle property (which may also be a column name.)

There are also standard text, fill, and line properties to control the appearance of the text, its background, as well as the rectangular bounding box border.

The data source is provided by setting the source property.

angle

property type: AngleSpec

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: Enum ( AngleUnits )

background_fill_alpha

property type: NumberSpec

The fill alpha values for the text bounding box.

background_fill_color

property type: ColorSpec

The fill color values for the text bounding box.

border_line_alpha

property type: NumberSpec

The line alpha values for the text bounding box.

border_line_cap

property type: Enum ( LineCap )

The line cap values for the text bounding box.

border_line_color

property type: ColorSpec

The line color values for the text bounding box.

border_line_dash

property type: DashPattern

The line dash values for the text bounding box.

border_line_dash_offset

property type: Int

The line dash offset values for the text bounding box.

border_line_join

property type: Enum ( LineJoin )

The line join values for the text bounding box.

border_line_width

property type: NumberSpec

The line width values for the text bounding box.

source

property type: Instance ( DataSource )

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

text

property type: StringSpec

The text values to render.

text_align

property type: Enum ( TextAlign )

The text align values for the text.

text_alpha

property type: NumberSpec

The text alpha values for the text.

text_baseline

property type: Enum ( TextBaseline )

The text baseline values for the text.

text_color

property type: ColorSpec

The text color values for the text.

text_font

property type: String

The text font values for the text.

text_font_size

property type: FontSizeSpec

The text font size values for the text.

text_font_style

property type: Enum ( FontStyle )

The text font style values for the text.

text_line_height

property type: Float

The text line height values for the text.

x

property type: NumberSpec

The x-coordinates to locate the text anchors.

x_offset

property type: NumberSpec

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: 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: Enum ( SpatialUnits )

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

y

property type: NumberSpec

The y-coordinates to locate the text anchors.

y_offset

property type: NumberSpec

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: 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: Enum ( SpatialUnits )

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": "bevel",
  "border_line_width": {
    "value": 1
  },
  "id": "3be060eb-af3a-4403-8c23-8b5a63e6b3db",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "annotation",
  "name": null,
  "plot": null,
  "render_mode": "canvas",
  "source": {
    "id": "3431a9f2-464d-4985-a170-e5b0724b3c3a",
    "type": "ColumnDataSource"
  },
  "subscribed_events": [],
  "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",
  "text_line_height": 1.2,
  "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)[source]

Bases: bokeh.models.annotations.Annotation

Render informational legends for a plot.

background_fill_alpha

property type: NumberSpec

The fill alpha for the legend background style.

background_fill_color

property type: ColorSpec

The fill color for the legend background style.

border_line_alpha

property type: NumberSpec

The line alpha for the legend border outline.

border_line_cap

property type: Enum ( LineCap )

The line cap for the legend border outline.

border_line_color

property type: ColorSpec

The line color for the legend border outline.

border_line_dash

property type: DashPattern

The line dash for the legend border outline.

border_line_dash_offset

property type: Int

The line dash offset for the legend border outline.

border_line_join

property type: Enum ( LineJoin )

The line join for the legend border outline.

border_line_width

property type: NumberSpec

The line width for the legend border outline.

click_policy

property type: Enum ( LegendClickPolicy )

Defines what happens when a lengend’s item is clicked.

glyph_height

property type: Int

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

glyph_width

property type: Int

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

inactive_fill_alpha

property type: NumberSpec

The fill alpha for the legend item style when inactive. These control an overlay on the item that can be used to obscure it when the corresponding glyph is inactive (e.g. by making it semi-transparent).

inactive_fill_color

property type: ColorSpec

The fill color for the legend item style when inactive. These control an overlay on the item that can be used to obscure it when the corresponding glyph is inactive (e.g. by making it semi-transparent).

items

property type: List ( Instance ( LegendItem ) )

A list of LegendItem instances to be rendered in the legend.

This can be specified explicitly, for instance:

legend = Legend(items=[
    LegendItem(label="sin(x)"   , renderers=[r0, r1]),
    LegendItem(label="2*sin(x)" , renderers=[r2]),
    LegendItem(label="3*sin(x)" , renderers=[r3, r4])
])

But as a convenience, can also be given more compactly as a list of tuples:

legend = Legend(items=[
    ("sin(x)"   , [r0, r1]),
    ("2*sin(x)" , [r2]),
    ("3*sin(x)" , [r3, r4])
])

where each tuple is of the form: (label, renderers).

label_height

property type: Int

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

label_standoff

property type: Int

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

label_text_align

property type: Enum ( TextAlign )

The text align for the legend labels.

label_text_alpha

property type: NumberSpec

The text alpha for the legend labels.

label_text_baseline

property type: Enum ( TextBaseline )

The text baseline for the legend labels.

label_text_color

property type: ColorSpec

The text color for the legend labels.

label_text_font

property type: String

The text font for the legend labels.

label_text_font_size

property type: FontSizeSpec

The text font size for the legend labels.

label_text_font_style

property type: Enum ( FontStyle )

The text font style for the legend labels.

label_text_line_height

property type: Float

The text line height for the legend labels.

label_width

property type: Int

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

location

property type: Either ( Enum ( Anchor ), 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).

margin

property type: Int

Amount of margin around the legend.

orientation

property type: Enum ( Orientation )

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

padding

property type: Int

Amount of padding around the contents of the legend. Only applicable when when border is visible, otherwise collapses to 0.

spacing

property type: Int

Amount of spacing (in pixles) between legend entries.

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": "bevel",
  "border_line_width": {
    "value": 1
  },
  "click_policy": "none",
  "glyph_height": 20,
  "glyph_width": 20,
  "id": "766f9e3d-9c34-49c8-8483-76b7f47e2409",
  "inactive_fill_alpha": {
    "value": 0.7
  },
  "inactive_fill_color": {
    "value": "white"
  },
  "items": [],
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "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_text_line_height": 1.2,
  "label_width": 20,
  "level": "annotation",
  "location": "top_right",
  "margin": 10,
  "name": null,
  "orientation": "vertical",
  "padding": 10,
  "plot": null,
  "spacing": 3,
  "subscribed_events": [],
  "tags": [],
  "visible": true
}
class LegendItem(*args, **kwargs)[source]

Bases: bokeh.model.Model

label

property type: StringSpec

A label for this legend. Can be a string, or a column of a ColumnDataSource. If label is a field, then it must be in the renderers’ data_source.

renderers

property type: List ( Instance ( GlyphRenderer ) )

A list of the glyph renderers to draw in the legend. If label is a field, then all data_sources of renderers must be the same.

JSON Prototype
{
  "id": "cf63e3ae-e289-4305-a0e1-86e4eb1994bc",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "label": null,
  "name": null,
  "renderers": [],
  "subscribed_events": [],
  "tags": []
}
class PolyAnnotation(**kwargs)[source]

Bases: bokeh.models.annotations.Annotation

Render a shaded polygonal region as an annotation.

fill_alpha

property type: NumberSpec

The fill alpha values for the polygon.

fill_color

property type: ColorSpec

The fill color values for the polygon.

line_alpha

property type: NumberSpec

The line alpha values for the polygon.

line_cap

property type: Enum ( LineCap )

The line cap values for the polygon.

line_color

property type: ColorSpec

The line color values for the polygon.

line_dash

property type: DashPattern

The line dash values for the polygon.

line_dash_offset

property type: Int

The line dash offset values for the polygon.

line_join

property type: Enum ( LineJoin )

The line join values for the polygon.

line_width

property type: NumberSpec

The line width values for the polygon.

x_range_name

property type: 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: Seq ( Float )

The x-coordinates of the region to draw.

xs_units

property type: Enum ( SpatialUnits )

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

y_range_name

property type: 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: Seq ( Float )

The y-coordinates of the region to draw.

ys_units

property type: Enum ( SpatialUnits )

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": "3526c648-18d1-4e4a-84e6-8517200ef413",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "annotation",
  "line_alpha": {
    "value": 0.3
  },
  "line_cap": "butt",
  "line_color": {
    "value": "#cccccc"
  },
  "line_dash": [],
  "line_dash_offset": 0,
  "line_join": "bevel",
  "line_width": {
    "value": 1
  },
  "name": null,
  "plot": null,
  "subscribed_events": [],
  "tags": [],
  "visible": true,
  "x_range_name": "default",
  "xs": [],
  "xs_units": "data",
  "y_range_name": "default",
  "ys": [],
  "ys_units": "data"
}
class Slope(**kwargs)[source]

Bases: bokeh.models.annotations.Annotation

Render a sloped line as an annotation.

gradient

property type: Float

The gradient of the line, in data units

line_alpha

property type: NumberSpec

The line alpha values for the line.

line_cap

property type: Enum ( LineCap )

The line cap values for the line.

line_color

property type: ColorSpec

The line color values for the line.

line_dash

property type: DashPattern

The line dash values for the line.

line_dash_offset

property type: Int

The line dash offset values for the line.

line_join

property type: Enum ( LineJoin )

The line join values for the line.

line_width

property type: NumberSpec

The line width values for the line.

x_range_name

property type: 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_intercept

property type: Float

The y intercept of the line, in data units

y_range_name

property type: 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
{
  "gradient": null,
  "id": "f38b8744-945d-452b-ad13-5ec91c13851e",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "annotation",
  "line_alpha": {
    "value": 1.0
  },
  "line_cap": "butt",
  "line_color": {
    "value": "black"
  },
  "line_dash": [],
  "line_dash_offset": 0,
  "line_join": "bevel",
  "line_width": {
    "value": 1
  },
  "name": null,
  "plot": null,
  "subscribed_events": [],
  "tags": [],
  "visible": true,
  "x_range_name": "default",
  "y_intercept": null,
  "y_range_name": "default"
}
class Span(**kwargs)[source]

Bases: bokeh.models.annotations.Annotation

Render a horizontal or vertical line span.

dimension

property type: Enum ( Dimension )

The direction of the span.

line_alpha

property type: NumberSpec

The line alpha values for the span.

line_cap

property type: Enum ( LineCap )

The line cap values for the span.

line_color

property type: ColorSpec

The line color values for the span.

line_dash

property type: DashPattern

The line dash values for the span.

line_dash_offset

property type: Int

The line dash offset values for the span.

line_join

property type: Enum ( LineJoin )

The line join values for the span.

line_width

property type: NumberSpec

The line width values for the span.

location

property type: Float

The location of the span, along dimension.

location_units

property type: Enum ( SpatialUnits )

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

render_mode

property type: Enum ( RenderMode )

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: 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: 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": "e9bbf75d-5348-46df-8cec-891be30d29a6",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "annotation",
  "line_alpha": {
    "value": 1.0
  },
  "line_cap": "butt",
  "line_color": {
    "value": "black"
  },
  "line_dash": [],
  "line_dash_offset": 0,
  "line_join": "bevel",
  "line_width": {
    "value": 1
  },
  "location": null,
  "location_units": "data",
  "name": null,
  "plot": null,
  "render_mode": "canvas",
  "subscribed_events": [],
  "tags": [],
  "visible": true,
  "x_range_name": "default",
  "y_range_name": "default"
}
class TextAnnotation(**kwargs)[source]

Bases: bokeh.models.annotations.Annotation

Base class for text annotation models such as labels and titles.

Note

This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.

render_mode

property type: Enum ( RenderMode )

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.

JSON Prototype
{
  "id": "9972e96d-71f2-41c2-abf3-726ea30d5402",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "annotation",
  "name": null,
  "plot": null,
  "render_mode": "canvas",
  "subscribed_events": [],
  "tags": [],
  "visible": true
}
class Title(**kwargs)[source]

Bases: bokeh.models.annotations.TextAnnotation

Render a single title box as an annotation.

align

property type: Enum ( TextAlign )

Aligment of the text in its enclosing space, along the direction of the text.

background_fill_alpha

property type: NumberSpec

The fill alpha values for the text bounding box.

background_fill_color

property type: ColorSpec

The fill color values for the text bounding box.

border_line_alpha

property type: NumberSpec

The line alpha values for the text bounding box.

border_line_cap

property type: Enum ( LineCap )

The line cap values for the text bounding box.

border_line_color

property type: ColorSpec

The line color values for the text bounding box.

border_line_dash

property type: DashPattern

The line dash values for the text bounding box.

border_line_dash_offset

property type: Int

The line dash offset values for the text bounding box.

border_line_join

property type: Enum ( LineJoin )

The line join values for the text bounding box.

border_line_width

property type: NumberSpec

The line width values for the text bounding box.

offset

property type: 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
text

property type: String

The text value to render.

text_alpha

property type: NumberSpec

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: ColorSpec

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: String

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

text_font_size

property type: FontSizeSpec

text_font_style

property type: Enum ( FontStyle )

A style to use for rendering text.

Acceptable values are:

  • 'normal' normal text
  • 'italic' italic text
  • 'bold' bold text
vertical_align

property type: Enum ( VerticalAlign )

Aligment of the text in its enclosing space, across the direction of the 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": "bevel",
  "border_line_width": {
    "value": 1
  },
  "id": "cbf71341-f76e-4723-a1aa-f8f9a921c4c1",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "annotation",
  "name": null,
  "offset": 0,
  "plot": null,
  "render_mode": "canvas",
  "subscribed_events": [],
  "tags": [],
  "text": null,
  "text_alpha": {
    "value": 1.0
  },
  "text_color": {
    "value": "#444444"
  },
  "text_font": "helvetica",
  "text_font_size": {
    "value": "10pt"
  },
  "text_font_style": "bold",
  "vertical_align": "bottom",
  "visible": true
}
class ToolbarPanel(**kwargs)[source]

Bases: bokeh.models.annotations.Annotation

toolbar

property type: Instance ( Toolbar )

A toolbar to display.

JSON Prototype
{
  "id": "aff44c9a-1747-4793-8944-d79d6246f5e1",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "annotation",
  "name": null,
  "plot": null,
  "subscribed_events": [],
  "tags": [],
  "toolbar": null,
  "visible": true
}
class Tooltip(**kwargs)[source]

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: Enum ( TooltipAttachment )

Whether the tooltip should be displayed to the left or right of 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: Bool

Whether to display outside a central plot frame area.

show_arrow

property type: Bool

Whether tooltip’s arrow should be showed.

JSON Prototype
{
  "attachment": "horizontal",
  "id": "8f4479d2-c7bb-40d5-8581-3120677ded8e",
  "inner_only": true,
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "overlay",
  "name": null,
  "plot": null,
  "show_arrow": true,
  "subscribed_events": [],
  "tags": [],
  "visible": true
}
class Whisker(**kwargs)[source]

Bases: bokeh.models.annotations.Annotation

Render a whisker along a dimension.

base

property type: DistanceSpec

The orthogonal coordinates of the upper and lower values.

base_units

property type: Enum ( SpatialUnits )

dimension

property type: Enum ( Dimension )

The direction of the band.

line_alpha

property type: NumberSpec

The line alpha values for the whisker body.

line_cap

property type: Enum ( LineCap )

The line cap values for the whisker body.

line_color

property type: ColorSpec

The line color values for the whisker body.

line_dash

property type: DashPattern

The line dash values for the whisker body.

line_dash_offset

property type: Int

The line dash offset values for the whisker body.

line_join

property type: Enum ( LineJoin )

The line join values for the whisker body.

line_width

property type: NumberSpec

The line width values for the whisker body.

lower

property type: DistanceSpec

The coordinates of the lower end of the whiskers.

lower_head

property type: Instance ( ArrowHead )

Instance of ArrowHead.

lower_units

property type: Enum ( SpatialUnits )

source

property type: Instance ( DataSource )

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

upper

property type: DistanceSpec

The coordinations of the upper end of the whiskers.

upper_head

property type: Instance ( ArrowHead )

Instance of ArrowHead.

upper_units

property type: Enum ( SpatialUnits )

x_range_name

property type: 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: 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
{
  "base": null,
  "dimension": "height",
  "id": "5c735dd7-ec6e-4941-be63-90e5d1151df1",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "level": "underlay",
  "line_alpha": {
    "value": 1.0
  },
  "line_cap": "butt",
  "line_color": {
    "value": "black"
  },
  "line_dash": [],
  "line_dash_offset": 0,
  "line_join": "bevel",
  "line_width": {
    "value": 1
  },
  "lower": null,
  "lower_head": {
    "id": "3aa104b7-d34e-42e5-ac0e-b27301d6ebf6",
    "type": "TeeHead"
  },
  "name": null,
  "plot": null,
  "source": {
    "id": "94ae210c-1418-46d6-9e20-121ab97d3118",
    "type": "ColumnDataSource"
  },
  "subscribed_events": [],
  "tags": [],
  "upper": null,
  "upper_head": {
    "id": "d296a9f3-1598-4977-9019-328561b27011",
    "type": "TeeHead"
  },
  "visible": true,
  "x_range_name": "default",
  "y_range_name": "default"
}