Configuring the Toolbar
This lesson reveals all the tools available to you for customizing the toolbar. Bokeh’s tools are configured for use with a mouse or touch devices. The tools and customizations include:
- The default tools
- Pan/Drag Tools
- Click/Tap Tools
- Scroll/Pinch Tools
- Actions
- Inspectors
- How to remove the Bokeh logo
- How to hide the toolbar
To geek out on tools , make sure to visit Specifying Tools in the Bokeh user guide.
00:00 This video is about configuring the toolbar. When you start with any figure, you’ll get a default toolbar. And the default tools start with a link to the Bokeh homepage, the pan tool, box zoom, wheel zoom,
00:16 the save tool, the reset tool, the hover tool, and then another link—this one to the Guide for Configuring Plot Tools. This is what will show up by default, but there are 18 different tools that you can pick from to customize your toolbar, and they work differently depending on if you’re using a touch device or if your user is using a mouse. The first set are pan and drag tools, and these tools are employed by either a panning with a touch device or left-clicking and dragging with the mouse. The first is the box select tool.
00:48
I’ve included the names of each of the tools to the right as they would be entered in your script. So for this first tool it’s "box_select"
.
00:57 Then there’s the box zoom tool. Then there’s the lasso select tool, which lets you draw a free hand shape around the items you’d like to select. Then there’s the pan tool, which can be set up to pan only the x-axis or the y-axis.
01:13 There are click and tap tools. These tools are employed by tapping—in the case of a touch device—or clicking directly on a glyph. The poly select tool, which I’ll demonstrate in an upcoming video, allows you to click several points to create a polygon of selection.
01:29 And then the tap tool allows you to tap on individual items. Many of these tools can be modified by holding the Shift key if you’re using a computer. Then there are the scroll/pinch tools.
01:40
These tools are employed by pinching or scrolling. You have the wheel zoom tool, which can be used as only an x- or a y-axis zoom. To use it, you use the scroll wheel on your mouse, and then the same thing can be used for panning, with an "x"
or a "y"
.
01:55
Then there’s a whole set of actions. These are activated only when their button is tapped or clicked. There’s the undo tool; the redo tool; reset tool, which can be useful if you’ve done a lot of selections and you want to go back to zero with the default layout for your visualization; the save tool, which will allow you to save an image PNG of the visualization at the state it’s in; and then there’s a zoom in tool, which also has "x"
and "y"
variations, and a zoom out tool, which again, same thing, has an "x"
and a "y"
variation.
02:27 Then there are two inspectors. These are passive tools that annotate or otherwise report information about the plot—the crosshair tool and the hover tool.
02:35 We have a couple of tutorials covering the hover tool and its tooltips coming up.
02:41 In some cases, you may want to remove the Bokeh logo from your visualization.
02:47
Since it is a link, it will open the Bokeh website in a new tab or window and can be very distracting or disrupting to the end users that you’ve given this visualization to. In that case, you’d call to the figure that it’s part of .toolbar.logo
and set that to None
.
03:04
And then, as you’ve seen before, if you don’t want to see a toolbar at all and don’t need that type of interaction, you can set the toolbar_location=None
. All right.
03:15 Now it’s time to start using these tools, and that’s coming up in the next video.
Chris Bailey RP Team on Sept. 16, 2019
I found in the new url scheme you can replace the version number with /latest/
. Here is the updated link, I will work on updating the links for the tutorial. Thanks!
Specifying Tools
Become a Member to join the conversation.
Ikones on Sept. 16, 2019
Thank you for the great explanations. The link for the geeks now has a sign of warning on top (… not the latest version). Would you know if anything has changed re. the tools, or if this the “old” documentation is still the best place to go, please?