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.
-
level
¶ property type: level:Enum(‘image’, ‘underlay’, ‘glyph’, ‘annotation’, ‘overlay’, ‘tool’)
Specifies the level in which to render the annotation.
-
plot
¶ property type: plot:Instance(Plot)
The plot to which this annotation is attached.
-
-
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, 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, Float)), Float)
The fill alpha values for the box.
-
fill_color
¶ property type: fill_color:ColorSpec(String, Dict(String, Either(String, Color)), Color)
The fill color values for the box.
-
left
¶ property type: left:Either(Auto, NumberSpec(String, Dict(String, Either(String, 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, 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, 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, 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, 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, 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.
-
-
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, Float)), Float)
The fill alpha for the legend background style.
-
background_fill_color
¶ property type: background_fill_color:ColorSpec(String, Dict(String, Either(String, Color)), Color)
The fill color for the legend background style.
-
border_line_alpha
¶ property type: border_line_alpha:NumberSpec(String, Dict(String, Either(String, 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, 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, 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 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, Float)), Float)
The text alpha for the legend labels.
-
label_text_baseline
¶ property type: label_text_baseline:Enum(‘top’, ‘middle’, ‘bottom’, ‘alphabetic’, ‘hanging’)
The text baseline for the legend labels.
-
label_text_color
¶ property type: label_text_color:ColorSpec(String, Dict(String, Either(String, 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, 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 width (in pixels) of the area that legend labels should occupy.
-
legend_padding
¶ property type: legend_padding:Int
Amount of padding around 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
¶ Deprecated in Bokeh 0.11; please use Legend.location instead.
-
-
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, Float)), Float)
The fill alpha values for the polygon.
-
fill_color
¶ property type: fill_color:ColorSpec(String, Dict(String, Either(String, Color)), Color)
The fill color values for the polygon.
-
line_alpha
¶ property type: line_alpha:NumberSpec(String, Dict(String, Either(String, 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, 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, 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.
-
-
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, 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, 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, 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.
-
-
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.
-
inner_only
¶ property type: inner_only:Bool
Whether to display outside a central plot frame area.
-
side
¶ property type: side:Either(Auto, Enum(‘left’, ‘right’))
Whether the tooltip should display to the left or right off the cursor position, or if it should be automatically placed.
-