☰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

WheelZoom active by default not working

Community Support
Fraser1
Fraser1

What I want to happen: The WheelZoomTool to be activated by default

What is actually happening: It’s not.

I must be missing something simple: I’m modifying this example. What am I doing wrong? Running Bokeh 0.12.9.

from bokeh.plotting import figure, output_file, show
from bokeh.models import WheelZoomTool

prepare some data

x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]

output to static HTML file

output_file(“lines.html”)

create a new plot with a title and axis labels

p = figure(title=“simple line example”, x_axis_label=‘x’, y_axis_label=‘y’)

add a line renderer with legend and line thickness

p.line(x, y, legend=“Temp.”, line_width=2)

This is the line that I’m struggling with

p.toolbar.active_scroll = WheelZoomTool()

show the results

show(p)

``

⌁   Link to post
Fraser1
Fraser1

Next step will be hiding the toolbar, but I’m sure that’ll be easy with:
p.toolbar_location = None

``

···

On Friday, October 6, 2017 at 2:30:13 PM UTC-7, Fraser wrote:

What I want to happen: The WheelZoomTool to be activated by default

What is actually happening: It’s not.

I must be missing something simple: I’m modifying this example. What am I doing wrong? Running Bokeh 0.12.9.

from bokeh.plotting import figure, output_file, show
from bokeh.models import WheelZoomTool

prepare some data

x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]

output to static HTML file

output_file(“lines.html”)

create a new plot with a title and axis labels

p = figure(title=“simple line example”, x_axis_label=‘x’, y_axis_label=‘y’)

add a line renderer with legend and line thickness

p.line(x, y, legend=“Temp.”, line_width=2)

This is the line that I’m struggling with

p.toolbar.active_scroll = WheelZoomTool()

show the results

show(p)

``

⌁   Link to post
Bryan
Bryan

You are setting the active_tool value to a random new wheel zoom tool that *isn't actually part of your plot*. There are a few different ways to make sure the tool you specify is actually the same as the tool that is on the plot, this is one:

  p.toolbar.active_scroll = p.select_one(WheelZoomTool)

Alternatively if you don't use the default tools (which includes the zoom tool) you could create the tool yourself and set it as the value and add it to the plot manually.

Thanks,

Bryan

···

On Oct 6, 2017, at 16:30, 'Fraser' via Bokeh Discussion - Public <bokeh@continuum.io> wrote:

from bokeh.plotting import figure, output_file, show
from bokeh.models import WheelZoomTool

# prepare some data
x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]

# output to static HTML file
output_file("lines.html")

# create a new plot with a title and axis labels
p = figure(title="simple line example", x_axis_label='x', y_axis_label='y')

# add a line renderer with legend and line thickness
p.line(x, y, legend="Temp.", line_width=2)

# This is the line that I'm struggling with
p.toolbar.active_scroll = WheelZoomTool()

# show the results
show(p)

⌁   Link to post
Bryan
Bryan

Yes, it is.

Thanks,

Bryan

···

On Oct 6, 2017, at 16:31, 'Fraser' via Bokeh Discussion - Public <bokeh@continuum.io> wrote:

Next step will be hiding the toolbar, but I'm sure that'll be easy with:
p.toolbar_location = None

On Friday, October 6, 2017 at 2:30:13 PM UTC-7, Fraser wrote:
What I want to happen: The WheelZoomTool to be activated by default
What is actually happening: It's not.

I must be missing something simple: I'm modifying this example. What am I doing wrong? Running Bokeh 0.12.9.

from bokeh.plotting import figure, output_file, show
from bokeh.models import WheelZoomTool

# prepare some data
x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]

# output to static HTML file
output_file("lines.html")

# create a new plot with a title and axis labels
p = figure(title="simple line example", x_axis_label='x', y_axis_label='y')

# add a line renderer with legend and line thickness
p.line(x, y, legend="Temp.", line_width=2)

# This is the line that I'm struggling with
p.toolbar.active_scroll = WheelZoomTool()

# show the results
show(p)

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/3fcbefdf-cfd8-4940-8d5a-f145f0673126%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Fraser1
Fraser1

Bryan, thank-you very much! I really appreciate the time to take on this group to help out - it really means a lot.

Cheers,

Fraser

···

On Friday, October 6, 2017 at 2:37:38 PM UTC-7, Bryan Van de ven wrote:

Yes, it is.

Thanks,

Bryan

On Oct 6, 2017, at 16:31, ‘Fraser’ via Bokeh Discussion - Public bo...@continuum.io wrote:

Next step will be hiding the toolbar, but I’m sure that’ll be easy with:

p.toolbar_location = None

On Friday, October 6, 2017 at 2:30:13 PM UTC-7, Fraser wrote:

What I want to happen: The WheelZoomTool to be activated by default

What is actually happening: It’s not.

I must be missing something simple: I’m modifying this example. What am I doing wrong? Running Bokeh 0.12.9.

from bokeh.plotting import figure, output_file, show

from bokeh.models import WheelZoomTool

prepare some data

x = [1, 2, 3, 4, 5]

y = [6, 7, 2, 4, 5]

output to static HTML file

output_file(“lines.html”)

create a new plot with a title and axis labels

p = figure(title=“simple line example”, x_axis_label=‘x’, y_axis_label=‘y’)

add a line renderer with legend and line thickness

p.line(x, y, legend=“Temp.”, line_width=2)

This is the line that I’m struggling with

p.toolbar.active_scroll = WheelZoomTool()

show the results

show(p)

–
You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/3fcbefdf-cfd8-4940-8d5a-f145f0673126%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post

End of archived discussion · Replies are disabled