Bokeh comes with a number of interactive tools.
There are five types of tool interactions:
Pan/Drag
Click/Tap
Scroll/Pinch
Actions
Inspectors
For the first three comprise the category of gesture tools, and only one tool for each gesture can be active at any given time. The active tool is indicated on the toolbar by a highlight next to the tool. Actions are immediate or modal operations that are only activated when their button in the toolbar is pressed. Inspectors are passive tools that merely report information or annotate the plot in some way, and may always be active regardless of what other tools are currently active.
Action
Bases: bokeh.models.tools.Tool
bokeh.models.tools.Tool
A base class for tools that are buttons in the toolbar.
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.
{ "id": "14463", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
BoxEditTool
Bases: bokeh.models.tools.EditTool, bokeh.models.tools.Drag, bokeh.models.tools.Tap
bokeh.models.tools.EditTool
bokeh.models.tools.Drag
bokeh.models.tools.Tap
toolbar icon:
Allows drawing, dragging and deleting Rect glyphs on one or more renderers by editing the underlying ColumnDataSource data. Like other drawing tools, the renderers that are to be edited must be supplied explicitly as a list. When drawing a new box the data will always be added to the ColumnDataSource on the first supplied renderer.
Rect
ColumnDataSource
The tool will modify the columns on the data source corresponding to the x, y, width and height values of the glyph. Any additional columns in the data source will be padded with empty_value, when adding a new box.
x
y
width
height
empty_value
The supported actions include:
Add box: Hold shift then click and drag anywhere on the plot or double tap once to start drawing, move the mouse and double tap again to finish drawing.
Move box: Click and drag an existing box, the box will be dropped once you let go of the mouse button.
Delete box: Tap a box to select it then press <<backspace>> key while the mouse is within the plot area.
To Move or Delete multiple boxes at once:
Move selection: Select box(es) with <<shift>>+tap (or another selection tool) then drag anywhere on the plot. Selecting and then dragging on a specific box will move both.
Delete selection: Select box(es) with <<shift>>+tap (or another selection tool) then press <<backspace>> while the mouse is within the plot area.
dimensions
property type: Enum ( Dimensions )
Enum
Dimensions
Which dimensions the box drawing is to be free in. By default, users may freely draw boxes with any dimensions. If only “width” is set, the box will be constrained to span the entire vertical space of the plot, only the horizontal dimension can be controlled. If only “height” is set, the box will be constrained to span the entire horizontal space of the plot, and the vertical dimension can be controlled.
num_objects
property type: Int
Int
Defines a limit on the number of boxes that can be drawn. By default there is no limit on the number of objects, but if enabled the oldest drawn box will be dropped to make space for the new box being added.
{ "custom_icon": null, "custom_tooltip": null, "dimensions": "both", "empty_value": null, "id": "14464", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "num_objects": 0, "renderers": [], "subscribed_events": [], "tags": [] }
BoxSelectTool
Bases: bokeh.models.tools.Drag
The box selection tool allows users to make selections on a Plot by showing a rectangular region by dragging the mouse or a finger over the plot area. The end of the drag event indicates the selection region is ready.
See Selected and Unselected Glyphs for information on styling selected and unselected glyphs.
callback
property type: Instance ( Callback )
Instance
Callback
A callback to run in the browser on completion of drawing a selection box. The cb_data parameter that is available to the Callback code will contain one BoxSelectTool-specific field:
cb_data
object containing the coordinates of the selection box
Which dimensions the box selection is to be free in. By default, users may freely draw selections boxes with any dimensions. If only “width” is set, the box will be constrained to span the entire vertical space of the plot, only the horizontal dimension can be controlled. If only “height” is set, the box will be constrained to span the entire horizontal space of the plot, and the vertical dimension can be controlled.
names
property type: List ( String )
List
String
A list of names to query for. If set, only renderers that have a matching value for their name attribute will be used.
name
origin
property type: Enum ( Enumeration(corner, center) )
Indicates whether the rectangular selection area should originate from a corner (top-left or bottom-right depending on direction) or the center of the box.
overlay
property type: Instance ( BoxAnnotation )
BoxAnnotation
A shaded annotation drawn to indicate the selection region.
renderers
property type: Either ( Auto , List ( Instance ( Renderer ) ) )
Either
Auto
Renderer
An explicit list of renderers to hit test against. If unset, defaults to all renderers on a plot.
select_every_mousemove
property type: Bool
Bool
Whether a selection computation should happen on every mouse event, or only once, when the selection region is completed. Default: False
{ "callback": null, "dimensions": "both", "id": "14467", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "names": [], "origin": "corner", "overlay": { "id": "14468", "type": "BoxAnnotation" }, "renderers": "auto", "select_every_mousemove": false, "subscribed_events": [], "tags": [] }
BoxZoomTool
The box zoom tool allows users to define a rectangular egion of a Plot to zoom to by dragging he mouse or a finger over the plot region. The end of the drag event indicates the selection region is ready.
BoxZoomTool is incompatible with GMapPlot due to the manner in which Google Maps exert explicit control over aspect ratios. Adding this tool to a GMapPlot will have no effect.
GMapPlot
Which dimensions the zoom box is to be free in. By default, users may freely draw zoom boxes with any dimensions. If only “width” is supplied, the box will be constrained to span the entire vertical space of the plot, only the horizontal dimension can be controlled. If only “height” is supplied, the box will be constrained to span the entire horizontal space of the plot, and the vertical dimension can be controlled.
match_aspect
Whether the box zoom region should be restricted to have the same aspect ratio as the plot region.
If the tool is restricted to one dimension, this value has no effect.
Indicates whether the rectangular zoom area should originate from a corner (top-left or bottom-right depending on direction) or the center of the box.
{ "dimensions": "both", "id": "14476", "js_event_callbacks": {}, "js_property_callbacks": {}, "match_aspect": false, "name": null, "origin": "corner", "overlay": { "id": "14477", "type": "BoxAnnotation" }, "subscribed_events": [], "tags": [] }
CrosshairTool
Bases: bokeh.models.tools.Inspection
bokeh.models.tools.Inspection
The crosshair tool is a passive inspector tool. It is generally on at all times, but can be configured in the inspector’s menu associated with the toolbar icon shown above.
The crosshair tool draws a crosshair annotation over the plot, centered on the current mouse position. The crosshair tool may be configured to draw across only one dimension by setting the dimension property to only width or height.
dimension
Which dimensions the crosshair tool is to track. By default, both vertical and horizontal lines will be drawn. If only “width” is supplied, only a horizontal line will be drawn. If only “height” is supplied, only a vertical line will be drawn.
line_alpha
property type: Float
Float
An alpha value to use to stroke paths with.
Acceptable values are floating point numbers between 0 (transparent) and 1 (opaque).
line_color
property type: Color
Color
A color to use to stroke paths with.
Acceptable values are:
any of the 147 named CSS colors, e.g 'green', 'indigo'
'green'
'indigo'
an RGB(A) hex value, e.g., '#FF0000', '#44444444'
'#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
line_width
Stroke width in units of pixels.
{ "dimensions": "both", "id": "14482", "js_event_callbacks": {}, "js_property_callbacks": {}, "line_alpha": 1.0, "line_color": "black", "line_width": 1, "name": null, "subscribed_events": [], "tags": [], "toggleable": true }
CustomAction
Bases: bokeh.models.tools.Action
bokeh.models.tools.Action
Execute a custom action, e.g. CustomJS callback when a toolbar icon is activated.
CustomJS
Example
tool = CustomAction(icon="icon.png", callback=CustomJS(code='alert("foo")')) plot.add_tools(tool)
action_tooltip
property type: String
Tooltip displayed when hovering over the custom action icon.
A Bokeh callback to execute when the custom action icon is activated.
icon
property type: Image
Image
An icon to display in the toolbar.
The icon can provided as a string filename for an image, a PIL Image object, or an RGB(A) NumPy array.
{ "action_tooltip": "Perform a Custom Action", "callback": null, "icon": null, "id": "14487", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
CustomJSHover
Bases: bokeh.model.Model
bokeh.model.Model
Define a custom formatter to apply to a hover tool field.
This model can be configured with JavaScript code to format hover tooltips. The JavaScript code has access to the current value to format, some special variables, and any format configured on the tooltip. The variable value will contain the untransformed value. The variable special_vars will provide a dict with the following contents:
value
special_vars
x data-space x-coordinate of the mouse
y data-space y-coordinate of the mouse
sx screen-space x-coordinate of the mouse
sx
sy screen-space y-coordinate of the mouse
sy
data_x data-space x-coordinate of the hovered glyph
data_x
data_y data-space y-coordinate of the hovered glyph
data_y
indices column indices of all currently hovered glyphs
indices
name value of the name property of the hovered glyph renderer
If the hover is over a “multi” glyph such as Patches or MultiLine then a segment_index key will also be present.
Patches
MultiLine
segment_index
Finally, the value of the format passed in the tooltip specification is available as the format variable.
format
As an example, the following code adds a custom formatter to format WebMercator northing coordinates (in meters) as a latitude:
lat_custom = CustomJSHover(code=""" var projections = require("core/util/projections"); var x = special_vars.x var y = special_vars.y var coords = projections.wgs84_mercator.inverse([x, y]) return "" + coords[1] """) p.add_tools(HoverTool( tooltips=[( 'lat','@y{custom}' )], formatters=dict(y=lat_custom) ))
Warning
The explicit purpose of this Bokeh Model is to embed raw JavaScript code for a browser to execute. If any part of the code is derived from untrusted user inputs, then you must take appropriate care to sanitize the user input prior to passing to Bokeh.
args
property type: Dict ( String , Instance ( Model ) )
Dict
Model
A mapping of names to Bokeh plot objects. These objects are made available to the callback code snippet as the values of named parameters to the callback.
code
A snippet of JavaScript code to transform a single value. The variable value will contain the untransformed value and can be expected to be present in the function namespace at render time. Additionally, the variable special_vars will be available, and will provide a dict with the following contents:
The snippet will be made into the body of a function and therefore requires a return statement.
Example:
code = ''' return value + " total" '''
from_coffeescript
Create a CustomJSHover instance from a CoffeeScript snippet. The function bodies are translated to JavaScript functions using node and therefore require return statements.
The code snippet namespace will contain the variable value (the untransformed value) at render time as well as special_vars and format as described in the class description.
formatter = CustomJSHover.from_coffeescript("return value + " total")
code (str) – A coffeescript snippet to transform a single value value
from_py_func
Create a CustomJSHover instance from a Python functions. The function is translated to JavaScript using PScript.
The python functions must have no positional arguments. It is possible to pass Bokeh models (e.g. a ColumnDataSource) as keyword arguments to the functions.
The code function namespace will contain the variable value (the untransformed value) at render time as well as format and special_vars as described in the class description.
code (function) – a scalar function to transform a single value
{ "args": {}, "code": "", "id": "14491", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
Drag
Bases: bokeh.models.tools.Gesture
bokeh.models.tools.Gesture
A base class for tools that respond to drag events.
{ "id": "14494", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
EditTool
A base class for all interactive draw tool types.
custom_icon
custom_tooltip
A custom tooltip label to override the default name.
property type: Either ( Bool , Int , Float , Date , Datetime , Color )
Date
Datetime
Defines the value to insert on non-coordinate columns when a new glyph is inserted into the ColumnDataSource columns, e.g. when a circle glyph defines ‘x’, ‘y’ and ‘color’ columns, adding a new point will add the x and y-coordinates to ‘x’ and ‘y’ columns and the color column will be filled with the defined empty value.
property type: List ( Instance ( Renderer ) )
An explicit list of renderers corresponding to scatter glyphs that may be edited.
{ "custom_icon": null, "custom_tooltip": null, "empty_value": null, "id": "14495", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "renderers": [], "subscribed_events": [], "tags": [] }
FreehandDrawTool
Allows freehand drawing of Patches and MultiLine glyphs. The glyph to draw may be defined via the renderers property.
The tool will modify the columns on the data source corresponding to the xs and ys values of the glyph. Any additional columns in the data source will be padded with the declared empty_value, when adding a new point.
xs
ys
Draw vertices: Click and drag to draw a line
Delete patch/multi-line: Tap a patch/multi-line to select it then press <<backspace>> key while the mouse is within the plot area.
Defines a limit on the number of patches or multi-lines that can be drawn. By default there is no limit on the number of objects, but if enabled the oldest drawn patch or multi-line will be overwritten when the limit is reached.
{ "custom_icon": null, "custom_tooltip": null, "empty_value": null, "id": "14500", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "num_objects": 0, "renderers": [], "subscribed_events": [], "tags": [] }
HelpTool
A button tool to provide a “help” link to users.
The hover text can be customized through the help_tooltip attribute and the redirect site overridden as well.
help_tooltip
Tooltip displayed when hovering over the help icon.
redirect
Site to be redirected through upon click.
{ "help_tooltip": "Click the question mark to learn more about Bokeh plot tools.", "id": "14502", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "redirect": "https://docs.bokeh.org/en/latest/docs/user_guide/tools.html", "subscribed_events": [], "tags": [] }
HoverTool
The hover tool is a passive inspector tool. It is generally on at all times, but can be configured in the inspector’s menu associated with the toolbar icon shown above.
By default, the hover tool displays informational tooltips whenever the cursor is directly over a glyph. The data to show comes from the glyph’s data source, and what to display is configurable with the tooltips property that maps display names to columns in the data source, or to special known variables.
tooltips
Here is an example of how to configure and use the hover tool:
# Add tooltip (name, field) pairs to the tool. See below for a # description of possible field values. hover.tooltips = [ ("index", "$index"), ("(x,y)", "($x, $y)"), ("radius", "@radius"), ("fill color", "$color[hex, swatch]:fill_color"), ("foo", "@foo"), ("bar", "@bar"), ("baz", "@baz{safe}"), ("total", "@total{$0,0.00}" ]
You can also supply a Callback to the HoverTool, to build custom interactions on hover. In this case you may want to turn the tooltips off by setting tooltips=None.
tooltips=None
When supplying a callback or custom template, the explicit intent of this Bokeh Model is to embed raw HTML and JavaScript code for a browser to execute. If any part of the code is derived from untrusted user inputs, then you must take appropriate care to sanitize the user input prior to passing to Bokeh.
Hover tool does not currently work with the following glyphs:
annulus arc bezier image image_rgba image_url oval patch quadratic ray text
annulus
arc
bezier
image
image_rgba
image_url
oval
patch
quadratic
ray
text
anchor
property type: Enum ( LegendLocation )
LegendLocation
If point policy is set to “snap_to_data”, anchor defines the attachment point of a tooltip. The default is to attach to the center of a glyph.
attachment
property type: Enum ( TooltipAttachment )
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.
A callback to run in the browser whenever the input’s value changes. The cb_data parameter that is available to the Callback code will contain two HoverTool specific fields:
object containing the indices of the hovered points in the data source
object containing the coordinates of the hover cursor
formatters
property type: Dict ( String , Either ( Enum ( TooltipFieldFormatter ), Instance ( CustomJSHover ) ) )
TooltipFieldFormatter
Specify the formatting scheme for data source columns, e.g.
tool.formatters = dict(date="datetime")
will cause format specifications for the “date” column to be interpreted according to the “datetime” formatting scheme. The following schemes are available:
Provides a wide variety of formats for numbers, currency, bytes, times, and percentages. The full set of formats can be found in the NumeralTickFormatter reference documentation.
NumeralTickFormatter
Provides formats for date and time values. The full set of formats is listed in the DatetimeTickFormatter reference documentation.
DatetimeTickFormatter
Provides formats similar to C-style “printf” type specifiers. See the PrintfTickFormatter reference documentation for complete details.
PrintfTickFormatter
If no formatter is specified for a column name, the default "numeral" formatter is assumed.
"numeral"
line_policy
property type: Enum ( Enumeration(prev, next, nearest, interp, none) )
When showing tooltips for lines, designates whether the tooltip position should be the “previous” or “next” points on the line, the “nearest” point to the current mouse position, or “interpolate” along the line to the current mouse position.
mode
property type: Enum ( Enumeration(mouse, hline, vline) )
Whether to consider hover pointer as a point (x/y values), or a span on h or v directions.
point_policy
property type: Enum ( Enumeration(snap_to_data, follow_mouse, none) )
Whether the tooltip position should snap to the “center” (or other anchor) position of the associated glyph, or always follow the current mouse cursor position.
show_arrow
Whether tooltip’s arrow should be shown.
property type: Either ( String , List ( Tuple ( String , String ) ) )
Tuple
The (name, field) pairs describing what the hover tool should display when there is a hit.
Field names starting with “@” are interpreted as columns on the data source. For instance, “@temp” would look up values to display from the “temp” column of the data source.
Field names starting with “$” are special, known fields:
index of hovered point in the data source
value of the name property of the hovered glyph renderer
x-coordinate under the cursor in data space
y-coordinate under the cursor in data space
x-coordinate under the cursor in screen (canvas) space
y-coordinate under the cursor in screen (canvas) space
color data from data source, with the syntax: $color[options]:field_name. The available options are: ‘hex’ (to display the color as a hex value), and ‘swatch’ to also display a small color swatch.
$color[options]:field_name
Field names that begin with @ are associated with columns in a ColumnDataSource. For instance the field name "@price" will display values from the "price" column whenever a hover is triggered. If the hover is for the 17th glyph, then the hover tooltip will correspondingly display the 17th price value.
@
"@price"
"price"
Note that if a column name contains spaces, the it must be supplied by surrounding it in curly braces, e.g. @{adjusted close} will display values from a column named "adjusted close".
@{adjusted close}
"adjusted close"
Sometimes (especially with stacked charts) it is desirable to allow the name of the column be specified indirectly. The field name @$name is distinguished in that it will look up the name field on the hovered glyph renderer, and use that value as the column name. For instance, if a user hovers with the name "US East", then @$name is equivalent to @{US East}.
@$name
"US East"
@{US East}
By default, values for fields (e.g. @foo) are displayed in a basic numeric format. However it is possible to control the formatting of values more precisely. Fields can be modified by appending a format specified to the end in curly braces. Some examples are below.
@foo
"@foo{0,0.000}" # formats 10000.1234 as: 10,000.123 "@foo{(.00)}" # formats -10000.1234 as: (10000.123) "@foo{($ 0.00 a)}" # formats 1230974 as: $ 1.23 m
Specifying a format {safe} after a field name will override automatic escaping of the tooltip data source. Any HTML tags in the data tags will be rendered as HTML in the resulting HoverTool output. See Custom Tooltip for a more detailed example.
{safe}
None is also a valid value for tooltips. This turns off the rendering of tooltips. This is mostly useful when supplying other actions on hover via the callback property.
None
The tooltips attribute can also be configured with a mapping type, e.g. dict or OrderedDict. However, if a dict is used, the visual presentation order is unspecified.
dict
OrderedDict
{ "anchor": "center", "attachment": "horizontal", "callback": null, "formatters": {}, "id": "14505", "js_event_callbacks": {}, "js_property_callbacks": {}, "line_policy": "nearest", "mode": "mouse", "name": null, "names": [], "point_policy": "snap_to_data", "renderers": "auto", "show_arrow": true, "subscribed_events": [], "tags": [], "toggleable": true, "tooltips": [ [ "index", "$index" ], [ "data (x, y)", "($x, $y)" ], [ "screen (x, y)", "($sx, $sy)" ] ] }
Inspection
A base class for tools that perform “inspections”, e.g. HoverTool.
toggleable
Whether an on/off toggle button should appear in the toolbar for this inspection tool. If False, the viewers of a plot will not be able to toggle the inspector on or off using the toolbar.
False
{ "id": "14517", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [], "toggleable": true }
Gesture
{ "id": "14519", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
LassoSelectTool
The lasso selection tool allows users to make selections on a Plot by indicating a free-drawn “lasso” region by dragging the mouse or a finger over the plot region. The end of the drag event indicates the selection region is ready.
Selections can be comprised of multiple regions, even those made by different selection tools. Hold down the <<shift>> key while making a selection to append the new selection to any previous selection that might exist.
A callback to run in the browser on every selection of a lasso area. The cb_data parameter that is available to the Callback code will contain one LassoSelectTool-specific field:
object containing the coordinates of the lasso area
property type: Instance ( PolyAnnotation )
PolyAnnotation
Whether a selection computation should happen on every mouse event, or only once, when the selection region is completed.
{ "callback": null, "id": "14520", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "names": [], "overlay": { "id": "14521", "type": "PolyAnnotation" }, "renderers": "auto", "select_every_mousemove": true, "subscribed_events": [], "tags": [] }
PanTool
The pan tool allows the user to pan a Plot by left-dragging a mouse, or on touch devices by dragging a finger or stylus, across the plot region.
The pan tool also activates the border regions of a Plot for “single axis” panning. For instance, dragging in the vertical border or axis will effect a pan in the vertical direction only, with horizontal dimension kept fixed.
Which dimensions the pan tool is constrained to act in. By default the pan tool will pan in any dimension, but can be configured to only pan horizontally across the width of the plot, or vertically across the height of the plot.
{ "dimensions": "both", "id": "14527", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
PointDrawTool
The PointDrawTool allows adding, dragging and deleting point-like glyphs (i.e subclasses of``XYGlyph``) on one or more renderers by editing the underlying ColumnDataSource data. Like other drawing tools, the renderers that are to be edited must be supplied explicitly as a list. Any newly added points will be inserted on the ColumnDataSource of the first supplied renderer.
The tool will modify the columns on the data source corresponding to the x and y values of the glyph. Any additional columns in the data source will be padded with the given empty_value when adding a new point.
The data source updates will trigger data change events continuously throughout the edit operations on the BokehJS side. In Bokeh server apps, the data source will only be synced once, when the edit operation finishes.
Add point: Tap anywhere on the plot
Move point: Tap and drag an existing point, the point will be dropped once you let go of the mouse button.
Delete point: Tap a point to select it then press <<backspace>> key while the mouse is within the plot area.
add
Enables adding of new points on tap events.
drag
Enables dragging of existing points on pan events.
Defines a limit on the number of points that can be drawn. By default there is no limit on the number of objects, but if enabled the oldest drawn point will be dropped to make space for the new point.
{ "add": true, "custom_icon": null, "custom_tooltip": null, "drag": true, "empty_value": null, "id": "14529", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "num_objects": 0, "renderers": [], "subscribed_events": [], "tags": [] }
PolyDrawTool
The PolyDrawTool allows drawing, selecting and deleting Patches and MultiLine glyphs on one or more renderers by editing the underlying ColumnDataSource data. Like other drawing tools, the renderers that are to be edited must be supplied explicitly.
If a vertex_renderer with an point-like glyph is supplied then the PolyDrawTool will use it to display the vertices of the multi-lines or patches on all supplied renderers. This also enables the ability to snap to existing vertices while drawing.
vertex_renderer
Add patch or multi-line: Double tap to add the first vertex, then use tap to add each subsequent vertex, to finalize the draw action double tap to insert the final vertex or press the <<esc> key.
Move patch or ulti-line: Tap and drag an existing patch/multi-line, the point will be dropped once you let go of the mouse button.
Delete patch or multi-line: Tap a patch/multi-line to select it then press <<backspace>> key while the mouse is within the plot area.
Enables dragging of existing patches and multi-lines on pan events.
Defines a limit on the number of patches or multi-lines that can be drawn. By default there is no limit on the number of objects, but if enabled the oldest drawn patch or multi-line will be dropped to make space for the new patch or multi-line.
property type: Instance ( GlyphRenderer )
GlyphRenderer
The renderer used to render the vertices of a selected line or polygon.
{ "custom_icon": null, "custom_tooltip": null, "drag": true, "empty_value": null, "id": "14533", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "num_objects": 0, "renderers": [], "subscribed_events": [], "tags": [], "vertex_renderer": null }
PolyEditTool
The PolyEditTool allows editing the vertices of one or more Patches or MultiLine glyphs. Glyphs to be edited are defined via the renderers property and a renderer for the vertices is set via the vertex_renderer property (must render a point-like Glyph (a subclass of XYGlyph).
XYGlyph
The tool will modify the columns on the data source corresponding to the xs and ys values of the glyph. Any additional columns in the data source will be padded with the declared``empty_value``, when adding a new point.
Show vertices: Double tap an existing patch or multi-line
Add vertex: Double tap an existing vertex to select it, the tool will draw the next point, to add it tap in a new location. To finish editing and add a point double tap otherwise press the <<esc> key to cancel.
Move vertex: Drag an existing vertex and let go of the mouse button to release it.
Delete vertex: After selecting one or more vertices press <<backspace>> while the mouse cursor is within the plot area.
{ "custom_icon": null, "custom_tooltip": null, "empty_value": null, "id": "14537", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "renderers": [], "subscribed_events": [], "tags": [], "vertex_renderer": null }
PolySelectTool
Bases: bokeh.models.tools.Tap
The polygon selection tool allows users to make selections on a Plot by indicating a polygonal region with mouse clicks. single clicks (or taps) add successive points to the definition of the polygon, and a double click (or tap) indicates the selection region is ready.
A callback to run in the browser on completion of drawing a polygon. The cb_data parameter that is available to the Callback code will contain one PolySelectTool-specific field:
object containing the coordinates of the polygon
{ "callback": null, "id": "14539", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "names": [], "overlay": { "id": "14540", "type": "PolyAnnotation" }, "renderers": "auto", "subscribed_events": [], "tags": [] }
ProxyToolbar
Bases: bokeh.models.tools.ToolbarBase
bokeh.models.tools.ToolbarBase
A toolbar that allow to merge and proxy tools of toolbars in multiple plots.
{ "autohide": false, "id": "14545", "js_event_callbacks": {}, "js_property_callbacks": {}, "logo": "normal", "name": null, "subscribed_events": [], "tags": [], "tools": [] }
RangeTool
The range tool allows the user to update range objects for either or both of the x- or y-dimensions by dragging a corresponding shaded annotation to move it or change its boundaries.
A common use case is to add this tool to a plot with a large fixed range, but to configure the tool range from a different plot. When the user manipulates the overlay, the range of the second plot will be updated automatically.
A shaded annotation drawn to indicate the configured ranges.
x_interaction
Whether to respond to horizontal pan motions when an x_range is present.
x_range
By default, when an x_range is specified, it is possible to adjust the horizontal position of the range box by panning horizontally inside the box, or along the top or bottom edge of the box. To disable this, and fix the range box in place horizontally, set to False. (The box will still update if the x_range is updated programmatically.)
property type: Instance ( Range1d )
Range1d
A range synchronized to the x-dimension of the overlay. If None, the overlay will span the entire x-dimension.
y_interaction
Whether to respond to vertical pan motions when a y_range is present.
y_range
By default, when a y_range is specified, it is possible to adjust the vertical position of the range box by panning vertically inside the box, or along the top or bottom edge of the box. To disable this, and fix the range box in place vertically, set to False. (The box will still update if the y_range is updated programmatically.)
A range synchronized to the y-dimension of the overlay. If None, the overlay will span the entire y-dimension.
{ "id": "14546", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "overlay": { "id": "14547", "type": "BoxAnnotation" }, "subscribed_events": [], "tags": [], "x_interaction": true, "x_range": null, "y_interaction": true, "y_range": null }
RedoTool
Redo tool reverses the last action performed by undo tool.
{ "id": "14553", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
ResetTool
The reset tool is an action. When activated in the toolbar, the tool resets the data bounds of the plot to their values when the plot was initially created.
{ "id": "14554", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
SaveTool
The save tool is an action. When activated, the tool opens a download dialog which allows to save an image reproduction of the plot in PNG format. If automatic download is not support by a web browser, the tool falls back to opening the generated image in a new tab or window. User then can manually save it by right clicking on the image and choosing “Save As” (or similar) menu item.
{ "id": "14555", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
Scroll
A base class for tools that respond to scroll events.
{ "id": "14556", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
Tap
A base class for tools that respond to tap/click events.
{ "id": "14557", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
TapTool
The tap selection tool allows the user to select at single points by left-clicking a mouse, or tapping with a finger.
behavior
property type: Enum ( Enumeration(select, inspect) )
This tool can be configured to either make selections or inspections on associated data sources. The difference is that selection changes propagate across bokeh and other components (e.g. selection glyph) will be notified. Inspections don’t act like this, so it’s useful to configure callback when setting behavior=’inspect’.
A callback to execute whenever a glyph is “hit” by a mouse click or tap.
This is often useful with the OpenURL model to open URLs based on a user clicking or tapping a specific glyph.
OpenURL
However, it may also be a CustomJS which can execute arbitrary JavaScript code in response to clicking or tapping glyphs. The callback will be executed for each individual glyph that is it hit by a click or tap, and will receive the TapTool model as cb_obj. The optional cb_data will have the data source as its .source attribute and the selection geometry as its .geometries attribute.
cb_obj
.source
.geometries
The .geometries attribute has 5 members. .type is the geometry type, which always a .point for a tap event. .sx and .sy are the screen X and Y coordinates where the tap occurred. .x and .y are the converted data coordinates for the item that has been selected. The .x and .y values are based on the axis assigned to that glyph.
.type
.point
.sx
.sy
.x
.y
This callback does not execute on every tap, only when a glyph is “hit”. If you would like to execute a callback on every mouse tap, please see CustomJS for User Interaction Events.
{ "behavior": "select", "callback": null, "id": "14558", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "names": [], "renderers": "auto", "subscribed_events": [], "tags": [] }
Tool
A base class for all interactive tool types.
{ "id": "14563", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
Toolbar
Collect tools to display for a single plot.
active_drag
property type: Either ( Auto , Instance ( Drag ) )
Specify a drag tool to be active when the plot is displayed.
active_inspect
property type: Either ( Auto , Instance ( Inspection ), Seq ( Instance ( Inspection ) ) )
Seq
Specify an inspection tool or sequence of inspection tools to be active when the plot is displayed.
active_multi
property type: Instance ( Gesture )
Specify an active multi-gesture tool, for instance an edit tool or a range tool.
Note that activating a multi-gesture tool will deactivate any other gesture tools as appropriate. For example, if a pan tool is set as the active drag, and this property is set to a BoxEditTool instance, the pan tool will be deactivated (i.e. the multi-gesture tool will take precedence).
active_scroll
property type: Either ( Auto , Instance ( Scroll ) )
Specify a scroll/pinch tool to be active when the plot is displayed.
active_tap
property type: Either ( Auto , Instance ( Tap ) )
Specify a tap/click tool to be active when the plot is displayed.
{ "active_drag": "auto", "active_inspect": "auto", "active_multi": null, "active_scroll": "auto", "active_tap": "auto", "autohide": false, "id": "14564", "js_event_callbacks": {}, "js_property_callbacks": {}, "logo": "normal", "name": null, "subscribed_events": [], "tags": [], "tools": [] }
ToolbarBase
A base class for different toolbars.
autohide
Whether the toolbar will be hidden by default. Default: False. If True, hides toolbar when cursor is not in canvas.
logo
property type: Enum ( Enumeration(normal, grey) )
What version of the Bokeh logo to display on the toolbar. If set to None, no logo will be displayed.
tools
property type: List ( Instance ( Tool ) )
A list of tools to add to the plot.
{ "autohide": false, "id": "14570", "js_event_callbacks": {}, "js_property_callbacks": {}, "logo": "normal", "name": null, "subscribed_events": [], "tags": [], "tools": [] }
ToolbarBox
Bases: bokeh.models.layouts.LayoutDOM
bokeh.models.layouts.LayoutDOM
A layoutable toolbar that can accept the tools of multiple plots, and can merge the tools into a single button for convenience.
toolbar
property type: Instance ( ToolbarBase )
A toolbar associated with a plot which holds all its tools.
toolbar_location
property type: Enum ( Location )
Location
{ "align": "start", "aspect_ratio": null, "background": null, "css_classes": [], "disabled": false, "height": null, "height_policy": "auto", "id": "14574", "js_event_callbacks": {}, "js_property_callbacks": {}, "margin": [ 0, 0, 0, 0 ], "max_height": null, "max_width": null, "min_height": null, "min_width": null, "name": null, "sizing_mode": null, "subscribed_events": [], "tags": [], "toolbar": null, "toolbar_location": "right", "visible": true, "width": null, "width_policy": "auto" }
UndoTool
Undo tool allows to restore previous state of the plot.
{ "id": "14577", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
WheelPanTool
Bases: bokeh.models.tools.Scroll
bokeh.models.tools.Scroll
The wheel pan tool allows the user to pan the plot along the configured dimension using the scroll wheel.
property type: Enum ( Dimension )
Dimension
Which dimension the wheel pan tool is constrained to act in. By default the wheel pan tool will pan the plot along the x-axis.
{ "dimension": "width", "id": "14578", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
WheelZoomTool
The wheel zoom tool will zoom the plot in and out, centered on the current mouse location.
The wheel zoom tool also activates the border regions of a Plot for “single axis” zooming. For instance, zooming in the vertical border or axis will effect a zoom in the vertical direction only, with the horizontal dimension kept fixed.
Which dimensions the wheel zoom tool is constrained to act in. By default the wheel zoom tool will zoom in any dimension, but can be configured to only zoom horizontally across the width of the plot, or vertically across the height of the plot.
maintain_focus
Whether or not zooming tool maintains its focus position. Setting to False results in a more “gliding” behavior, allowing one to zoom out more smoothly, at the cost of losing the focus position.
speed
Speed at which the wheel zooms. Default is 1/600. Optimal range is between 0.001 and 0.09. High values will be clipped. Speed may very between browsers.
zoom_on_axis
Whether scrolling on an axis (outside the central plot area) should zoom that dimension.
{ "dimensions": "both", "id": "14580", "js_event_callbacks": {}, "js_property_callbacks": {}, "maintain_focus": true, "name": null, "speed": 0.0016666666666666668, "subscribed_events": [], "tags": [], "zoom_on_axis": true }
ZoomInTool
The zoom-in tool allows users to click a button to zoom in by a fixed amount.
Which dimensions the zoom-in tool is constrained to act in. By default the zoom-in zoom tool will zoom in any dimension, but can be configured to only zoom horizontally across the width of the plot, or vertically across the height of the plot.
factor
property type: Percent
Percent
Percentage to zoom for each click of the zoom-in tool.
{ "dimensions": "both", "factor": 0.1, "id": "14585", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }
ZoomOutTool
The zoom-out tool allows users to click a button to zoom out by a fixed amount.
Which dimensions the zoom-out tool is constrained to act in. By default the zoom-out tool will zoom in any dimension, but can be configured to only zoom horizontally across the width of the plot, or vertically across the height of the plot.
{ "dimensions": "both", "factor": 0.1, "id": "14588", "js_event_callbacks": {}, "js_property_callbacks": {}, "name": null, "subscribed_events": [], "tags": [] }