Models for representing top-level plot objects.
Plot
Bases: bokeh.models.layouts.LayoutDOM
bokeh.models.layouts.LayoutDOM
Model representing a plot, containing glyphs, guides, annotations.
above
property type: List ( Instance ( Renderer ) )
List
Instance
Renderer
A list of renderers to occupy the area above of the plot.
aspect_scale
property type: Float
Float
A value to be given for increased aspect ratio control. This value is added multiplicatively to the calculated value required for match_aspect. aspect_scale is defined as the ratio of width over height of the figure.
match_aspect
For example, a plot with aspect_scale value of 2 will result in a square in data units to be drawn on the screen as a rectangle with a pixel width twice as long as its pixel height.
Note
This setting only takes effect if match_aspect is set to True.
True
background_fill_alpha
property type: NumberSpec
NumberSpec
The fill alpha for the plot background style.
background_fill_color
property type: ColorSpec
ColorSpec
The fill color for the plot background style.
below
A list of renderers to occupy the area below of the plot.
border_fill_alpha
The fill alpha for the plot border style.
border_fill_color
The fill color for the plot border style.
center
A list of renderers to occupy the center area (frame) of the plot.
extra_x_ranges
property type: Dict ( String , Instance ( Range ) )
Dict
String
Range
Additional named ranges to make available for mapping x-coordinates.
This is useful for adding additional axes.
extra_y_ranges
Additional named ranges to make available for mapping y-coordinates.
frame_height
property type: Int
Int
The height of a plot frame or the inner height of a plot, excluding any axes, titles, border padding, etc.
frame_width
The width of a plot frame or the inner width of a plot, excluding any axes, titles, border padding, etc.
hidpi
property type: Bool
Bool
Whether to use HiDPI mode when available.
inner_height
This is the exact height of the plotting canvas, i.e. the height of the actual plot, without toolbars etc. Note this is computed in a web browser, so this property will work only in backends capable of bidirectional communication (server, notebook).
This is an experimental feature and the API may change in near future.
inner_width
This is the exact width of the plotting canvas, i.e. the width of the actual plot, without toolbars etc. Note this is computed in a web browser, so this property will work only in backends capable of bidirectional communication (server, notebook).
left
A list of renderers to occupy the area to the left of the plot.
lod_factor
Decimation factor to use when applying level-of-detail decimation.
lod_interval
Interval (in ms) during which an interactive tool event will enable level-of-detail downsampling.
lod_threshold
A number of data points, above which level-of-detail downsampling may be performed by glyph renderers. Set to None to disable any level-of-detail downsampling.
None
lod_timeout
Timeout (in ms) for checking whether interactive tool events are still occurring. Once level-of-detail mode is enabled, a check is made every lod_timeout ms. If no interactive tool events have happened, level-of-detail mode is disabled.
Specify the aspect ratio behavior of the plot. Aspect ratio is defined as the ratio of width over height. This property controls whether Bokeh should attempt the match the (width/height) of data space to the (width/height) in pixels of screen space.
Default is False which indicates that the data aspect ratio and the screen aspect ratio vary independently. True indicates that the plot aspect ratio of the axes will match the aspect ratio of the pixel extent the axes. The end result is that a 1x1 area in data space is a square in pixels, and conversely that a 1x1 pixel is a square in data units.
False
This setting only takes effect when there are two dataranges. This setting only sets the initial plot draw and subsequent resets. It is possible for tools (single axis zoom, unconstrained box zoom) to change the aspect ratio.
Warning
This setting is incompatible with linking dataranges across multiple plots. Doing so may result in undefined behaviour.
min_border
A convenience property to set all all the min_border_X properties to the same value. If an individual border property is explicitly set, it will override min_border.
min_border_X
min_border_bottom
Minimum size in pixels of the padding region below the bottom of the central plot region.
This is a minimum. The padding region may expand as needed to accommodate titles or axes, etc.
min_border_left
Minimum size in pixels of the padding region to the left of the central plot region.
min_border_right
Minimum size in pixels of the padding region to the right of the central plot region.
min_border_top
Minimum size in pixels of the padding region above the top of the central plot region.
outer_height
This is the exact height of the layout, i.e. the height of the actual plot, with toolbars etc. Note this is computed in a web browser, so this property will work only in backends capable of bidirectional communication (server, notebook).
outer_width
This is the exact width of the layout, i.e. the height of the actual plot, with toolbars etc. Note this is computed in a web browser, so this property will work only in backends capable of bidirectional communication (server, notebook).
outline_line_alpha
The line alpha for the plot border outline.
outline_line_cap
property type: Enum ( LineCap )
Enum
LineCap
The line cap for the plot border outline.
outline_line_color
The line color for the plot border outline.
outline_line_dash
property type: DashPattern
DashPattern
The line dash for the plot border outline.
outline_line_dash_offset
The line dash offset for the plot border outline.
outline_line_join
property type: Enum ( LineJoin )
LineJoin
The line join for the plot border outline.
outline_line_width
The line width for the plot border outline.
output_backend
property type: Enum ( OutputBackend )
OutputBackend
Specify the output backend for the plot area. Default is HTML5 Canvas.
When set to webgl, glyphs without a WebGL rendering implementation will fall back to rendering onto 2D canvas.
webgl
plot_height
The outer height of a plot, including any axes, titles, border padding, etc.
This corresponds directly to the height of the HTML canvas.
plot_width
The outer width of a plot, including any axes, titles, border padding, etc.
This corresponds directly to the width of the HTML canvas.
renderers
A list of all renderers for this plot, including guides and annotations in addition to glyphs and markers.
This property can be manipulated by hand, but the add_glyph and add_layout methods are recommended to help make sure all necessary setup is performed.
add_glyph
add_layout
reset_policy
property type: Enum ( ResetPolicy )
ResetPolicy
How a plot should respond to being reset. By deafult, the standard actions are to clear any tool state history, return plot ranges to their original values, undo all selections, and emit a Reset event. If customization is desired, this property may be set to "event_only", which will suppress all of the actions except the Reset event.
Reset
"event_only"
right
A list of renderers to occupy the area to the right of the plot.
title
property type: Instance ( Title )
Title
A title for the plot. Can be a text string or a Title annotation.
title_location
property type: Enum ( Location )
Location
Where the title will be located. Titles on the left or right side will be rotated.
toolbar
property type: Instance ( Toolbar )
Toolbar
The toolbar associated with this plot which holds all the tools. It is automatically created with the plot if necessary.
toolbar_location
Where the toolbar will be located. If set to None, no toolbar will be attached to the plot.
toolbar_sticky
Stick the toolbar to the edge of the plot. Default: True. If False, the toolbar will be outside of the axes, titles etc.
x_range
property type: Instance ( Range )
The (default) data range of the horizontal dimension of the plot.
x_scale
property type: Instance ( Scale )
Scale
What kind of scale to use to convert x-coordinates in data space into x-coordinates in screen space.
y_range
The (default) data range of the vertical dimension of the plot.
y_scale
What kind of scale to use to convert y-coordinates in data space into y-coordinates in screen space.
Adds a glyph to the plot with associated data sources and ranges.
This function will take care of creating and configuring a Glyph object, and then add it to the plot’s list of renderers.
source (DataSource) – a data source for the glyphs to all use
glyph (Glyph) – the glyph to add to the Plot
additional keyword arguments are passed on as-is to the (Any) –
initializer. (Glyph) –
GlyphRenderer
Adds an object to the plot in a specified place.
obj (Renderer) – the object to add to the Plot
place (str, optional) – where to add the object (default: ‘center’) Valid places are: ‘left’, ‘right’, ‘above’, ‘below’, ‘center’.
add_tile
Adds new TileRenderer into Plot.renderers
TileRenderer
Plot.renderers
tile_source (TileSource) – a tile source instance which contain tileset configuration
keyword arguments are passed on as-is to the tile renderer (Additional) –
add_tools
Adds tools to the plot.
*tools (Tool) – the tools to add to the Plot
column
Return whether this plot is in a given column of a GridPlot.
col (int) – index of the column to test
gridplot (GridPlot) – the GridPlot to check
bool
row
Return whether this plot is in a given row of a GridPlot.
row (int) – index of the row to test
select
Query this object and all of its references for objects that match the given selector.
There are a few different ways to call the select method. The most general is to supply a JSON-like query dictionary as the single argument or as keyword arguments:
selector (JSON-like) – some sample text
kwargs – query dict key/values as keyword arguments
Additionally, for compatibility with Model.select, a selector dict may be passed as selector keyword argument, in which case the value of kwargs['selector'] is used for the query.
Model.select
selector
kwargs['selector']
For convenience, queries on just names can be made by supplying the name string as the single parameter:
name
name (str) – the name to query on
Also queries on just type can be made simply by supplying the Model subclass as the single parameter:
Model
type (Model) – the type to query on
seq[Model]
Examples
# These three are equivalent p.select(selector={"type": HoverTool}) p.select({"type": HoverTool}) p.select(HoverTool) # These two are also equivalent p.select({"name": "mycircle"}) p.select("mycircle") # Keyword arguments can be supplied in place of selector dict p.select({"name": "foo", "type": HoverTool}) p.select(name="foo", type=HoverTool)
axis
Splattable list of Axis objects.
Axis
grid
Splattable list of Grid objects.
Grid
h_symmetry
hover
Splattable list of HoverTool objects.
HoverTool
legend
Splattable list of Legend objects.
Legend
tools
v_symmetry
xaxis
Splattable list of Axis objects for the x dimension.
xgrid
Splattable list of Grid objects for the x dimension.
yaxis
Splattable list of Axis objects for the y dimension.
ygrid
Splattable list of Grid objects for the y dimension.
{ "above": [], "align": "start", "aspect_ratio": null, "aspect_scale": 1, "background": null, "background_fill_alpha": { "value": 1.0 }, "background_fill_color": { "value": "#ffffff" }, "below": [], "border_fill_alpha": { "value": 1.0 }, "border_fill_color": { "value": "#ffffff" }, "center": [], "css_classes": [], "disabled": false, "extra_x_ranges": {}, "extra_y_ranges": {}, "frame_height": null, "frame_width": null, "height": null, "height_policy": "auto", "hidpi": true, "id": "14207", "js_event_callbacks": {}, "js_property_callbacks": {}, "left": [], "lod_factor": 10, "lod_interval": 300, "lod_threshold": 2000, "lod_timeout": 500, "margin": [ 0, 0, 0, 0 ], "match_aspect": false, "max_height": null, "max_width": null, "min_border": 5, "min_border_bottom": null, "min_border_left": null, "min_border_right": null, "min_border_top": null, "min_height": null, "min_width": null, "name": null, "outline_line_alpha": { "value": 1.0 }, "outline_line_cap": "butt", "outline_line_color": { "value": "#e5e5e5" }, "outline_line_dash": [], "outline_line_dash_offset": 0, "outline_line_join": "bevel", "outline_line_width": { "value": 1 }, "output_backend": "canvas", "plot_height": 600, "plot_width": 600, "renderers": [], "reset_policy": "standard", "right": [], "sizing_mode": null, "subscribed_events": [], "tags": [], "title": { "id": "14213", "type": "Title" }, "title_location": "above", "toolbar": { "id": "14210", "type": "Toolbar" }, "toolbar_location": "right", "toolbar_sticky": true, "visible": true, "width": null, "width_policy": "auto", "x_range": { "id": "14208", "type": "DataRange1d" }, "x_scale": { "id": "14211", "type": "LinearScale" }, "y_range": { "id": "14209", "type": "DataRange1d" }, "y_scale": { "id": "14212", "type": "LinearScale" } }