Best way to turn off zoom tool by default?

I find the zoom tool on plots very annoying, as whenever I am scrolling through notebooks, plots will hijack my zoom wheel and start moving plots around in funny ways, then I always have to hit the chart reset button and continue scrolling, being careful to be outside the chart.

I find the documentation on modifying tools to be hard to understand. Does anyone know the best way to turn zoom tool off by default for all hvplot charts?

Thanks!

plot.opts(default_tools=["pan"])

1 Like

That’s a good remark, HoloViews has turned wheel_zoom by default recently (in Set pan and wheel_zoom as the default Bokeh active tools by maximlt · Pull Request #5480 · holoviz/holoviews · GitHub, followed-up by this fix Fix active_tools to only be set for enabled tools by Hoxbro · Pull Request #5616 · holoviz/holoviews · GitHub) as it seems like it is what you want in most cases when you create a single plot, for easier exploration. But indeed when you want to scroll through a page and that instead you end up zooming in by mistake on one or more plots, it’s not great UX!

I thought this would work, it didn’t:

import holoviews as hv

hv.opts.defaults(active_tools=['pan'])

So instead I tried updating the default of active_tools on ElementPlot, the base class of all the (bokeh here) Elements, and it worked:

import holoviews as hv

hv.plotting.bokeh.element.ElementPlot.active_tools = ['pan']  # or `['box_zoom'], or any tool that's not `['wheel_zoom']` :)

It’d certainly be worth looking into what’s the default of other interactive plotting libraries.

2 Likes

I’m actually very appreciative of the wheel zoom being on by default, as most of the interactive data inspection is about zooming in/out, rather than just panning around.

Maybe the middle-ground is to improve how one can customize the plotting defaults.

3 Likes