Bokeh – Plot Tools

Bokeh - Plot Tools

Bokeh plot tools are rendered, normally a toolbar appears on the right side of the figure. It contains a default set of tools. First of all, the position of the toolbar can be configured by the toolbar_location property in the figure() function. This property can take one of the following values −

  • “above”
  • “below”
  • “left”
  • “right”
  • “None”

For example, the following statement will cause the toolbar to be displayed below the plot −

Fig = figure(toolbar_location = "below")

This toolbar can be configured according to the requirement by adding the required from various tools defined in bokeh. models module. For example −

Fig.add_tools(WheelZoomTool())

Bokeh PlotThe tools can be classified under the following categories −

  • Pan/Drag Tools
  • Click/Tap Tools
  • Scroll/Pinch Tools
ToolDescription
BoxSelectToolName : ‘box_select’allows the user to define a rectangular selection region by left-dragging a mouse
LassoSelectToolname: ‘lasso_selectallows the user to define an arbitrary region for selection by left-dragging a mouse
PanToolname: ‘pan’, ‘xpan’, ‘ypan’,allows the user to pan the plot by left-dragging a mouse
TapToolname: ‘tapallows the user to select at single points by clicking a left mouse button
WheelZoomToolname: ‘wheel_zoom’, ‘xwheel_zoom’, ‘ywheel_zoom’zoom the plot in and out, centered on the current mouse location.
WheelPanToolname: ‘xwheel_pan’, ‘ywheel_pan’translate the plot window along the specified dimension without changing the window’s aspect ratio.
ResetToolname: ‘reset’restores the plot ranges to their original values.
SaveToolname: ‘save’allows the user to save a PNG image of the plot.
ZoomInToolname: ‘zoom_in’, ‘xzoom_in’, ‘yzoom_in’The zoom-in tool will increase the zoom of the plot in x, y, or both coordinates
ZoomOutToolname: ‘zoom_out’, ‘xzoom_out’, ‘yzoom_out’The zoom-out tool will decrease the zoom of the plot in x, y, or both coordinates
CrosshairToolname: ‘crosshair’draws a crosshair annotation over the plot, centered on the current mouse position.

Next Topic – Click Here

This Post Has One Comment

Leave a Reply