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:
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 <[email protected]> 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()
On Oct 6, 2017, at 16:31, 'Fraser' via Bokeh Discussion - Public <[email protected]> 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()