Plot Tools
Bokeh plots are interactive by default: the toolbar provides pan, zoom, box-select, lasso, hover, and reset tools. You choose which tools appear, add custom ones, and wire hover tooltips to your data - the core of making a chart feel like a dashboard.
Default Tools
from bokeh.plotting import figure
p = figure(tools="pan,wheel_zoom,box_zoom,reset,hover,save")
# tools can be a comma string or a list of tool instances
Configuring the Toolbar
from bokeh.plotting import figure
from bokeh.models import Toolbar, HoverTool
p = figure()
p.circle([1, 2, 3], [4, 5, 6])
p.toolbar.logo = "none" # remove the Bokeh logo
p.toolbar.location = "above" # above, below, left, right
p.toolbar.button_style = "outline"
Hover Tool and Tooltips
from bokeh.models import HoverTool
hover = HoverTool(
tooltips=[
("index", "$index"),
("data (x, y)", "($x, $y)"),
("screen", "($xsin, $ysin)"),
("name", "@name"),
],
)
p = figure(tools=[hover])
p.circle([1, 2, 3], [4, 5, 6])
Special tokens: $x/$y are data coordinates, $xsin/$ysin are screen pixels, @column references a ColumnDataSource field, $name gives the point index.
Selection Tools
p = figure(tools="pan,box_select,lasso_select,undo,redo,reset")
p.circle([1, 2, 3, 4], [1, 2, 3, 4])
# inspect the selection:
p.select(type=BoxSelectTool).dimensions = "width" # 1-D box selection
Adding and Removing Tools
from bokeh.models import SaveTool, ResetTool
p.add_tool(SaveTool())
p.add_tool(ResetTool())
# remove all tools of a type:
from bokeh.models import PanTool
p.tools = [t for t in p.tools if not isinstance(t, PanTool)]
Disabling Interaction
p = figure(tools="") # static chart, e.g. for export to a report
Summary
Control plot interactivity with the tools argument (pan, wheel_zoom, box_zoom, reset, hover, save, box_select, lasso_select), configure the toolbar (logo, location), add HoverTool with tooltip templates ($x, @column, $index), and add or remove specific tool instances with add_tool. Set tools="" for a static export.