bokeh.models.tools

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 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.

class Action(**kwargs)[source]

Bases: 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.

JSON Prototype
{
  "id": "9ee34d2f-51da-4b4a-ad9f-f1186854480a",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class BoxEditTool(**kwargs)[source]

Bases: bokeh.models.tools.EditTool, bokeh.models.tools.Drag, bokeh.models.tools.Tap

toolbar icon: box_edit_icon

The BoxEditTool 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.

The tool will automatically 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 the declared empty_value, when adding a new box.

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 )

Which dimensions the box drawing is to be free in. By default, users may freely draw 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.

JSON Prototype
{
  "dimensions": "both",
  "empty_value": null,
  "id": "215f2fe6-1fdd-42fe-b963-5ed759f5bba1",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "renderers": [],
  "subscribed_events": [],
  "tags": []
}
class BoxSelectTool(**kwargs)[source]

Bases: bokeh.models.tools.Drag

toolbar icon: box_select_icon

The box selection tool allows users to make selections on a Plot by indicating a rectangular region by dragging the mouse or a finger over the plot region. 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 )

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:

Geometry:object containing the coordinates of the selection box
dimensions

property type: Enum ( Dimensions )

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 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.

names

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

overlay

property type: Instance ( BoxAnnotation )

A shaded annotation drawn to indicate the selection region.

renderers

property type: List ( Instance ( Renderer ) )

An explicit list of renderers to hit test again. If unset, defaults to all renderers on a plot.

select_every_mousemove

property type: Bool

Whether a selection computation should happen on every mouse event, or only once, when the selection region is completed. Default: False

JSON Prototype
{
  "callback": null,
  "dimensions": "both",
  "id": "4ac6e9a0-35d0-42e5-a8ae-3093c454ec71",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "names": [],
  "overlay": {
    "id": "6a922b76-24b2-4c5b-9edd-2ab990d361ca",
    "type": "BoxAnnotation"
  },
  "renderers": [],
  "select_every_mousemove": false,
  "subscribed_events": [],
  "tags": []
}
class BoxZoomTool(**kwargs)[source]

Bases: bokeh.models.tools.Drag

toolbar icon: box_zoom_icon

The box zoom tool allows users to define a rectangular region 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.

dimensions

property type: Enum ( Dimensions )

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

property type: Bool

Whether the box zoom region should be restricted to have the same aspect ratio as the plot region.

Note

If the tool is restricted to one dimension, this value has no effect.

overlay

property type: Instance ( BoxAnnotation )

A shaded annotation drawn to indicate the selection region.

JSON Prototype
{
  "dimensions": "both",
  "id": "8cff315a-5e0c-4112-938c-8259b2103162",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "match_aspect": false,
  "name": null,
  "overlay": {
    "id": "264b4cbe-8e28-4008-bde7-ae1c0cd54638",
    "type": "BoxAnnotation"
  },
  "subscribed_events": [],
  "tags": []
}
class CrosshairTool(**kwargs)[source]

Bases: bokeh.models.tools.Inspection

toolbar icon: crosshair_icon

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.

dimensions

property type: Enum ( Dimensions )

Which dimensions the crosshair tool is to track. By default, both a vertical and horizontal line 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

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

A color to use to stroke paths 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
line_width

property type: Float

Stroke width in units of pixels.

JSON Prototype
{
  "dimensions": "both",
  "id": "646b2667-4354-453b-a282-c54190d3035b",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "line_alpha": 1.0,
  "line_color": "black",
  "line_width": 1,
  "name": null,
  "subscribed_events": [],
  "tags": [],
  "toggleable": true
}
class Drag(**kwargs)[source]

Bases: bokeh.models.tools.Tool

A base class for tools that respond to drag events.

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.

JSON Prototype
{
  "id": "a97d09e3-1cad-4118-b961-486b7e6353c5",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class EditTool(**kwargs)[source]

Bases: bokeh.models.tools.Tool

A base class for all interactive draw tool types.

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.

empty_value

property type: Either ( Bool , Int , Float , Date , Datetime , Color )

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.

renderers

property type: List ( Instance ( Renderer ) )

An explicit list of renderers corresponding to scatter glyphs that may be edited.

JSON Prototype
{
  "empty_value": null,
  "id": "441a8a62-1661-4976-a743-34212bfff990",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "renderers": [],
  "subscribed_events": [],
  "tags": []
}
class HelpTool(**kwargs)[source]

Bases: bokeh.models.tools.Action

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

property type: String

Tooltip displayed when hovering over the help icon.

redirect

property type: String

Site to be redirected through upon click.

JSON Prototype
{
  "help_tooltip": "Click the question mark to learn more about Bokeh plot tools.",
  "id": "292fbded-4b93-4c7f-9bd5-a086a8b39ebc",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "redirect": "https://bokeh.pydata.org/en/latest/docs/user_guide/tools.html#built-in-tools",
  "subscribed_events": [],
  "tags": []
}
class HoverTool(**kwargs)[source]

Bases: bokeh.models.tools.Inspection

toolbar icon: crosshair_icon

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 is to be displayed is configurable with the tooltips attribute that maps display names to columns in the data source, or to special known variables.

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.

Warning

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
anchor

property type: Enum ( Anchor )

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 )

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.

callback

property type: Instance ( Callback )

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:

Index:object containing the indices of the hovered points in the data source
Geometry:object containing the coordinates of the hover cursor
formatters

property type: Dict ( String , Enum ( 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 schemed are available:

“numeral”: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.
“datetime”:Provides formats for date and time values. The full set of formats is listed in the DatetimeTickFormatter reference documentation.
“printf”:Provides formats similar to C-style “printf” type specifiers. See the PrintfTickFormatter reference documentation for complete details.

If no formatter is specified for a column name, the default "numeral" formatter is assumed.

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.

names

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

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.

renderers

property type: List ( Instance ( Renderer ) )

An explicit list of renderers to hit test again. If unset, defaults to all renderers on a plot.

show_arrow

property type: Bool

Whether tooltip’s arrow should be showed.

tooltips

property type: Either ( String , List ( Tuple ( String , String ) ) )

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:index of selected point in the data source
$x:x-coordinate under the cursor in data space
$y:y-coordinate under the cursor in data space
$sx:x-coordinate under the cursor in screen (canvas) space
$sy:y-coordinate under the cursor in screen (canvas) space
$color: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.

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.

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".

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{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.

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.

Note

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.

JSON Prototype
{
  "anchor": "center",
  "attachment": "horizontal",
  "callback": null,
  "formatters": {},
  "id": "d9619fc8-77a0-4128-8431-c2693cbae3c1",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "line_policy": "nearest",
  "mode": "mouse",
  "name": null,
  "names": [],
  "point_policy": "snap_to_data",
  "renderers": [],
  "show_arrow": true,
  "subscribed_events": [],
  "tags": [],
  "toggleable": true,
  "tooltips": [
    [
      "index",
      "$index"
    ],
    [
      "data (x, y)",
      "($x, $y)"
    ],
    [
      "screen (x, y)",
      "($sx, $sy)"
    ]
  ]
}
class Inspection(**kwargs)[source]

Bases: bokeh.models.tools.Tool

A base class for tools that perform “inspections”, e.g. HoverTool.

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.

toggleable

property type: Bool

Whether an on/off toggle button should appear in the toolbar for this inpection tool. If False, the viewers of a plot will not be able to toggle the inspector on or off using the toolbar.

JSON Prototype
{
  "id": "9fa6ce0f-2016-45f1-82d3-20dfee8c3487",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": [],
  "toggleable": true
}
class LassoSelectTool(**kwargs)[source]

Bases: bokeh.models.tools.Drag

toolbar icon: lasso_select_icon

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.

See Selected and Unselected Glyphs for information on styling selected and unselected glyphs.

Note

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.

callback

property type: Instance ( Callback )

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:

Geometry:object containing the coordinates of the lasso area
names

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

overlay

property type: Instance ( PolyAnnotation )

A shaded annotation drawn to indicate the selection region.

renderers

property type: List ( Instance ( Renderer ) )

An explicit list of renderers to hit test again. If unset, defaults to all renderers on a plot.

select_every_mousemove

property type: Bool

Whether a selection computation should happen on every mouse event, or only once, when the selection region is completed. Default: True

JSON Prototype
{
  "callback": null,
  "id": "94a4d8c6-772d-4e90-8b32-2214aa16445a",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "names": [],
  "overlay": {
    "id": "621d4456-f70d-4155-ab1d-24211807c930",
    "type": "PolyAnnotation"
  },
  "renderers": [],
  "select_every_mousemove": true,
  "subscribed_events": [],
  "tags": []
}
class PanTool(**kwargs)[source]

Bases: bokeh.models.tools.Drag

toolbar icon: pan_icon

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 the horizontal dimension kept fixed.

dimensions

property type: Enum ( Dimensions )

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.

JSON Prototype
{
  "dimensions": "both",
  "id": "7dc19229-407a-46fb-896e-2f02caeed6eb",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class PointDrawTool(**kwargs)[source]

Bases: bokeh.models.tools.EditTool, bokeh.models.tools.Drag, bokeh.models.tools.Tap

toolbar icon: point_draw_icon

The PointDrawTool allows adding, dragging and deleting point-like glyphs (of XYGlyph type) 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 automatically 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 declared empty_value, when adding a new point.

The supported actions include:

  • 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

property type: Bool

Enables adding of new points on tap events.

drag

property type: Bool

Enables dragging of existing points on pan events.

JSON Prototype
{
  "add": true,
  "drag": true,
  "empty_value": null,
  "id": "fc0e8d87-60fa-431a-9979-c5ccbcee7834",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "renderers": [],
  "subscribed_events": [],
  "tags": []
}
class PolyDrawTool(**kwargs)[source]

Bases: bokeh.models.tools.EditTool, bokeh.models.tools.Drag, bokeh.models.tools.Tap

toolbar icon: poly_draw_icon

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 as a list.

The tool will automatically 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.

The supported actions include:

  • Add patch/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/multi-line: Tap and drag an existing patch/multi-line, the point will be dropped once you let go of the mouse button.
  • Delete patch/multi-line: Tap a patch/multi-line to select it then press <<backspace>> key while the mouse is within the plot area.
drag

property type: Bool

Enables dragging of existing patches and multi-lines on pan events.

JSON Prototype
{
  "drag": true,
  "empty_value": null,
  "id": "1bb51092-ba5e-4c23-b45c-530a14c6925a",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "renderers": [],
  "subscribed_events": [],
  "tags": []
}
class PolyEditTool(**kwargs)[source]

Bases: bokeh.models.tools.EditTool, bokeh.models.tools.Drag, bokeh.models.tools.Tap

toolbar icon: poly_edit_icon

The PolyEditTool allows editing the vertices of one or more Patches or MultiLine glyphs. The glyphs to be edited can be defined via the renderers property and the renderer for the vertices can be defined via the vertex_renderer, which must render a point-like Glyph (of XYGlyph type).

The tool will automatically 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.

The supported actions include:

  • 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.
vertex_renderer

property type: Instance ( GlyphRenderer )

The renderer used to render the vertices of a selected line or polygon.

JSON Prototype
{
  "empty_value": null,
  "id": "def03f7b-e1f5-4143-b89e-0c4b4bae27de",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "renderers": [],
  "subscribed_events": [],
  "tags": [],
  "vertex_renderer": null
}
class PolySelectTool(**kwargs)[source]

Bases: bokeh.models.tools.Tap

toolbar icon: poly_select_icon

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.

See Selected and Unselected Glyphs for information on styling selected and unselected glyphs.

Note

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.

callback

property type: Instance ( Callback )

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:

Geometry:object containing the coordinates of the polygon
names

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

overlay

property type: Instance ( PolyAnnotation )

A shaded annotation drawn to indicate the selection region.

renderers

property type: List ( Instance ( Renderer ) )

An explicit list of renderers to hit test again. If unset, defaults to all renderers on a plot.

JSON Prototype
{
  "callback": null,
  "id": "7bed76aa-9c10-401e-8940-1025760b32f9",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "names": [],
  "overlay": {
    "id": "f1146864-4ac5-4efd-bd99-f6b1e7d6a1fa",
    "type": "PolyAnnotation"
  },
  "renderers": [],
  "subscribed_events": [],
  "tags": []
}
class ProxyToolbar(**kwargs)[source]

Bases: bokeh.models.tools.ToolbarBase

A toolbar that allow to merge and proxy tools of toolbars in multiple plots.

JSON Prototype
{
  "id": "4b3de7db-9143-459a-810d-135aa24f5691",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "logo": "normal",
  "name": null,
  "subscribed_events": [],
  "tags": [],
  "tools": []
}
class RedoTool(**kwargs)[source]

Bases: bokeh.models.tools.Action

toolbar icon: redo_icon

Redo tool reverses the last action performed by undo tool.

JSON Prototype
{
  "id": "a84ebefe-402a-4f18-8505-381e2ad27c79",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class ResetTool(**kwargs)[source]

Bases: bokeh.models.tools.Action

toolbar icon: reset_icon

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.

Optionally, the reset tool also resets the plat canvas dimensions to their original size

JSON Prototype
{
  "id": "38c68f85-d5ee-473c-917e-cae13f56f844",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class SaveTool(**kwargs)[source]

Bases: bokeh.models.tools.Action

toolbar icon: save_icon

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.

JSON Prototype
{
  "id": "d3d536f1-8b32-4273-acf0-4a63dc6c2062",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class Scroll(**kwargs)[source]

Bases: bokeh.models.tools.Tool

A base class for tools that respond to scroll events.

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.

JSON Prototype
{
  "id": "12d364c2-f0bf-4373-8917-c506083df5b6",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class Tap(**kwargs)[source]

Bases: bokeh.models.tools.Tool

A base class for tools that respond to tap/click events.

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.

JSON Prototype
{
  "id": "2445539d-bf37-47b2-9057-a29dd7d5e63e",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class TapTool(**kwargs)[source]

Bases: bokeh.models.tools.Tap

toolbar icon: tap_icon

The tap selection tool allows the user to select at single points by left-clicking a mouse, or tapping with a finger.

See Selected and Unselected Glyphs for information on styling selected and unselected glyphs.

Note

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.

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. Inspecions don’t act like this, so it’s useful to configure callback when setting behavior=’inspect’.

callback

property type: Instance ( Callback )

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.

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.

Note

This callback does not execute on every tap, only when a glyphs is “hit”. If you would like to execute a callback on every mouse tap, please see CustomJS for User Interaction Events.

names

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

renderers

property type: List ( Instance ( Renderer ) )

An explicit list of renderers to hit test again. If unset, defaults to all renderers on a plot.

JSON Prototype
{
  "behavior": "select",
  "callback": null,
  "id": "daa954c6-7d7c-4f61-9381-b99fec279d62",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "names": [],
  "renderers": [],
  "subscribed_events": [],
  "tags": []
}
class Tool(**kwargs)[source]

Bases: bokeh.model.Model

A base class for all interactive tool types.

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
JSON Prototype
{
  "id": "7bbe4744-c842-4447-9009-9c48e2bac6c8",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class Toolbar(**kwargs)[source]

Bases: bokeh.models.tools.ToolbarBase

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 ) ) )

Specify an inspection tool or sequence of inspection tools to be active when the plot is displayed.

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.

JSON Prototype
{
  "active_drag": "auto",
  "active_inspect": "auto",
  "active_scroll": "auto",
  "active_tap": "auto",
  "id": "2c406410-e00a-40f5-be65-b09ea8ff5177",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "logo": "normal",
  "name": null,
  "subscribed_events": [],
  "tags": [],
  "tools": []
}
class ToolbarBase(**kwargs)[source]

Bases: bokeh.model.Model

A base class for different toolbars.

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.

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.

JSON Prototype
{
  "id": "330d46c6-5c59-43ef-9217-da6356808cbc",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "logo": "normal",
  "name": null,
  "subscribed_events": [],
  "tags": [],
  "tools": []
}
class ToolbarBox(**kwargs)[source]

Bases: 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 )

JSON Prototype
{
  "css_classes": [],
  "disabled": false,
  "height": null,
  "id": "6008616d-74ac-4f1d-be37-3d3d354a4417",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "sizing_mode": "fixed",
  "subscribed_events": [],
  "tags": [],
  "toolbar": null,
  "toolbar_location": "right",
  "width": null
}
class UndoTool(**kwargs)[source]

Bases: bokeh.models.tools.Action

toolbar icon: undo_icon

Undo tool allows to restore previous state of the plot.

JSON Prototype
{
  "id": "4e7b96e3-08bc-46a4-8569-6aa8a9314d7e",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class WheelPanTool(**kwargs)[source]

Bases: bokeh.models.tools.Scroll

toolbar icon: wheel_pan_icon

The wheel pan tool allows the user to pan the plot along the configured dimension using the scroll wheel.

dimension

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

JSON Prototype
{
  "dimension": "width",
  "id": "c6fb419f-6bc9-4067-9233-52a1dd727b51",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class WheelZoomTool(**kwargs)[source]

Bases: bokeh.models.tools.Scroll

toolbar icon: wheel_zoom_icon

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.

dimensions

property type: Enum ( Dimensions )

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

property type: Bool

Whether or not zooming tool maintains its focus position. Setting it to False results in a more “gliding” behavior, allowing one to zoom out more smoothly, at the cost of losing the focus position.

JSON Prototype
{
  "dimensions": "both",
  "id": "3af65745-b047-430b-b6af-31ad2319a3e8",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "maintain_focus": true,
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class ZoomInTool(**kwargs)[source]

Bases: bokeh.models.tools.Action

toolbar icon: zoom_in_icon

The zoom-in tool allows users to click a button to zoom in by a fixed amount.

dimensions

property type: Enum ( Dimensions )

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

Percentage to zoom for each click of the zoom-in tool.

JSON Prototype
{
  "dimensions": "both",
  "factor": 0.1,
  "id": "3b058402-ca37-4310-b6c1-b6c2b907de6a",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class ZoomOutTool(**kwargs)[source]

Bases: bokeh.models.tools.Action

toolbar icon: zoom_out_icon

The zoom-out tool allows users to click a button to zoom out by a fixed amount.

dimensions

property type: Enum ( Dimensions )

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.

factor

property type: Percent

Percentage to zoom for each click of the zoom-in tool.

JSON Prototype
{
  "dimensions": "both",
  "factor": 0.1,
  "id": "3828a08e-6a31-467d-a205-9e03ff4569a8",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
DEFAULT_BOX_OVERLAY()
DEFAULT_POLY_OVERLAY()