Disable bokeh plot axis scrolling

Is there any way to disable axis scrolling (for example using scroll wheel over x-axis zooms the axis)?

I’ve tried setting options for default_tools, tools, and active_tools without the xwheel_zoom and ywheel_zoom but it looks like the tools are not controlling this behavior? (I do need wheel_zoom for the plot though).

I’d like to avoid this behavior in a geoviews plot so that you can’t adjust the x and y axes:

Relevant docs:

This feature was added here: https://github.com/bokeh/bokeh/issues/7815
Relevant discussion: https://github.com/pyviz-topics/EarthSim/issues/45

I was able to achieve this functionality by creating a custom instance of the WheelZoomTool:

import geoviews.feature as gvfs
import holoviews as hv
from bokeh.models import WheelZoomTool

wheel_zoom = WheelZoomTool(zoom_on_axis=False)
gvts.OSM().opts(default_tools=['pan', wheel_zoom],)
1 Like

Thanks for posting the solution here. Could you do me another favor and file a GeoViews issue to do this by default on geographic plots?

1 Like