WheelZoom active by default not working

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§

``

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§

``

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 <[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()

# show the results
show(p)

Yes, it is.

Thanks,

Bryan

···

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()

# 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 [email protected].
To post to this group, send email to [email protected].
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.

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 [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()

show the results

show§


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 [email protected].

To post to this group, send email to [email protected].

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.