☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Wheel_zoom problems?

Community Support
mmcguffi
mmcguffi

When I try to use the wheel_zoom tool, I get some strange behavior. If I scroll just near an axis, it only changes that axis. Perhaps this is intended behavior? Is there a way to remove this behavior?

(minimal?) working example:

import pandas as pd
from bokeh.io import show
from bokeh.plotting import figure
from bokeh.models import HoverTool, ColumnDataSource, WheelZoomTool

url='https://raw.githubusercontent.com/mmcguffi/random_test_cases/master/test.csv'
df=pd.read_csv(url,index_col=0)
df['x'] = pd.eval(df['x']) #convert to list
df['y'] = pd.eval(df['y']) #convert to list

hover = HoverTool(names=["1"])
TOOLTIPS='<font size="3"><b>@Feature</b> — @Type</font> <br> @Description'
plotSize=.35
plotDimen=800
p = figure(plot_height=plotDimen,plot_width=plotDimen, title="", toolbar_location=None, match_aspect=True,sizing_mode='scale_width',
               tools=[hover,'pan',"wheel_zoom"],active_scroll="wheel_zoom", tooltips=TOOLTIPS, x_range=(-plotSize, plotSize), y_range=(-plotSize, plotSize))
p.circle(x=0, y=0, radius=.205, line_color="#000000", fill_color=None, line_width=2)

source = ColumnDataSource(df)
p.patches('x', 'y', fill_color='fill_color', line_color='line_color', name="1", line_width=2, source=source)
show(p)


Furthermore, this touches on an other “bug” I have encountered – as you can see the circle is /not/ scaled in one dimension along with the patches. This also happens when I view my Bokeh plot in Full Screen zoom view via Streamlit.

⌁   Link to post
Bryan
Bryan

@mmcguffi That is indeed intended behavior, to allow for easily zooming in a single dimension. If you don’t want the axis-zooming behavior, you can set the zoom tool’s zoom_on_axis property to False.

Regarding the other question, I can dig up all the GH issues if you like, but TLDR; if you are plotting circles that have a radius in data-space units, you should probably always set match_aspect to True on the figure. That is the only way to ensure that the data-space aspect ratio, and the canvas pixel aspect ratio match up, and that is a necessary condition to avoid the situation above.

⌁   Link to post
Bryan
Bryan

@mmcguffi match_aspect is only a property of plots. Have you set explicit range values? match_aspect only works with default data ranges. If you set explicit range start/end values Bokeh assumes you know what you want and will not override what you specify (even if that means the aspect ratios won’t match).

⌁   Link to post

End of archived discussion · Replies are disabled