Reputation: 429
I haven't found how to activate the wheel_zoom by default when using gridplot to organize different plots.
active_scroll='wheel_zoom'
p1 = figure(title='figure #1')
p1.line([1,2,3,4,5], [2,5,8,2,7], color="red")
p2 = figure(title='figure #2', x_range=p1.x_range)
p2.line([1,2,3,4,5], [4,3,4,1,3], color="blue")
p3 = figure(title='figure #3', x_range=p1.x_range)
p3.line([1,2,3,4,5], [5,1,6,3,2], color="green")
show(gridplot([p1,p2, p3], ncols=1, plot_width=600, plot_height=200))
Upvotes: 3
Views: 2281
Reputation: 6367
I followed the instructions on bokeh dokumentation in the section "setting tools to active" and I found the parameter active_scroll
. You can set it to "wheel_zoom"
, then this tool will be activated.
To activate it for every whole figure, you have to add it 3 times (to every subfigure) or you have to merge all 3 tools of the subfigure into one in the gridplot using merge_tools=True
. Otherwise the figure corresponds only to a part.
This code snippet is working in my jupyter notebook, but the wheel zoom tool is not marked as active as you would expect. In fact the first click on the symbol will activate it again.
from bokeh.plotting import figure, show, output_notebook
from bokeh.layouts import gridplot
output_notebook()
p1 = figure(title='figure #1', active_scroll ="wheel_zoom")
p1.line([1,2,3,4,5], [2,5,8,2,7], color="red")
p2 = figure(title='figure #2', x_range=p1.x_range)
p2.line([1,2,3,4,5], [4,3,4,1,3], color="blue")
p3 = figure(title='figure #3', x_range=p1.x_range)
p3.line([1,2,3,4,5], [5,1,6,3,2], color="green")
show(gridplot([p1,p2, p3], ncols=1, plot_width=600, plot_height=200, merge_tools=True))
Upvotes: 4