☰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 with axis bounds

Community Support
chupach1
chupach1

I am using wheel_zoom (x-axis) and did set boundaries (on the x-axis).

After zooming in, I’d like to get the plot back to both boundaries when zooming out.

But the zoom out stops as soon as one of the boundary is reached.

Any way to customise so that zoom out does not stop until the second boundary is reached ?

Thx for any tips.

⌁   Link to post
Bryan
Bryan

Hi,

AFAIK this mode of operation is not currently supported and it would take new development to make things (optionally) work this way. Please feel free to open a feature request on GitHub to discuss it:

  Issues · bokeh/bokeh · GitHub

However, if your interest is in restoring the original plot bounds, perhaps the "reset" tool is actually what you need?

Thanks,

Bryan

···

On Dec 22, 2016, at 12:24 PM, chupach <mathieur1507@gmail.com> wrote:

I am using wheel_zoom (x-axis) and did set boundaries (on the x-axis).

After zooming in, I'd like to get the plot back to both boundaries when zooming out.
But the zoom out stops as soon as one of the boundary is reached.

Any way to customise so that zoom out does not stop until the second boundary is reached ?

Thx for any tips.

--
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/7cb9250f-b840-48cb-88aa-a74ae22ffafc%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
chupach1
chupach1

thank you for your quick answer, I will soon submit the feature request

As for the reset tool suggestion, it does not work and i am unsure why, but it seems to be related to using custom tick formatters.

···

On Thursday, December 22, 2016 at 7:29:13 PM UTC+1, Bryan Van de ven wrote:

Hi,

AFAIK this mode of operation is not currently supported and it would take new development to make things (optionally) work this way. Please feel free to open a feature request on GitHub to discuss it:

    [https://github.com/bokeh/bokeh/issues](https://github.com/bokeh/bokeh/issues)

However, if your interest is in restoring the original plot bounds, perhaps the “reset” tool is actually what you need?

Thanks,

Bryan

On Dec 22, 2016, at 12:24 PM, chupach mathie...@gmail.com wrote:

I am using wheel_zoom (x-axis) and did set boundaries (on the x-axis).

After zooming in, I’d like to get the plot back to both boundaries when zooming out.
But the zoom out stops as soon as one of the boundary is reached.

Any way to customise so that zoom out does not stop until the second boundary is reached ?

Thx for any tips.

–
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/7cb9250f-b840-48cb-88aa-a74ae22ffafc%40continuum.io.

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

⌁   Link to post
Bryan
Bryan

Hi,

I can't imagine how a custom tick formatter could interact at all with the reset tool, but if the reset tool is not behaving as expected, please try to share a minimal complete test case that reproduces the behavior, it might be a bug that needs fixing.

Thanks,

Bryan

···

On Dec 22, 2016, at 12:45 PM, chupach <mathieur1507@gmail.com> wrote:

thank you for your quick answer, I will soon submit the feature request

As for the reset tool suggestion, it does not work and i am unsure why, but it seems to be related to using custom tick formatters.

On Thursday, December 22, 2016 at 7:29:13 PM UTC+1, Bryan Van de ven wrote:
Hi,

AFAIK this mode of operation is not currently supported and it would take new development to make things (optionally) work this way. Please feel free to open a feature request on GitHub to discuss it:

        Issues · bokeh/bokeh · GitHub

However, if your interest is in restoring the original plot bounds, perhaps the "reset" tool is actually what you need?

Thanks,

Bryan

> On Dec 22, 2016, at 12:24 PM, chupach <mathie...@gmail.com> wrote:
>
> I am using wheel_zoom (x-axis) and did set boundaries (on the x-axis).
>
> After zooming in, I'd like to get the plot back to both boundaries when zooming out.
> But the zoom out stops as soon as one of the boundary is reached.
>
> Any way to customise so that zoom out does not stop until the second boundary is reached ?
>
> Thx for any tips.
>
>
>
>
>
> --
> 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/7cb9250f-b840-48cb-88aa-a74ae22ffafc%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/66c004f9-38ca-4e69-b44f-4c2234f46d40%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
chupach1
chupach1

Ok i explored a bit: the y-axis is automatically adjusted on xpan and xwheel zoom with the code below.
However, that works only with the error in jscode (last line). The error prevents reset tool to work properly.

The best of course would be to be able to get rid of the last line, console.log(x); and have the y-axis tracking still working.

I likely do something wrong: without the generated error , the change in the y-axis is not triggered.
I did not find a way to trigger it.

from bokeh.plotting import figure
from bokeh.io import curdoc
from bokeh.models import ColumnDataSource,CustomJS
from bokeh.layouts import column,row
import numpy as np

jscode="""
    var start = Math.floor(cb_obj.start);
    var end = Math.floor(cb_obj.end);
    var y = source.data['y'].slice(start, end);
    var yv = [Math.min(...y),Math.max(...y)];
    var dy = yv[1] - yv[0];
    yrange.start = yv[0]-0.2*dy;
    yrange.end = yv[1]+0.2*dy;
    console.log(x);
    """

n=100
x = np.arange(n)
y = np.random.rand(n)+x/50
p = figure(plot_width=400, plot_height=200,tools = 'reset,box_zoom,xwheel_zoom,xwheel_pan')
cds = ColumnDataSource({'x':x,'y':y})
p.line(x='x',y='y', source=cds)
p.x_range.callback = CustomJS(args=dict(yrange=p.y_range,source=cds), code=jscode)

curdoc().add_root(p)

···

On 22 Dec 2016, at 19:46, Bryan Van de Ven <bryan@bokeh.org> wrote:

Hi,

I can't imagine how a custom tick formatter could interact at all with the reset tool, but if the reset tool is not behaving as expected, please try to share a minimal complete test case that reproduces the behavior, it might be a bug that needs fixing.

Thanks,

Bryan

On Dec 22, 2016, at 12:45 PM, chupach <mathieur1507@gmail.com> wrote:

thank you for your quick answer, I will soon submit the feature request

As for the reset tool suggestion, it does not work and i am unsure why, but it seems to be related to using custom tick formatters.

On Thursday, December 22, 2016 at 7:29:13 PM UTC+1, Bryan Van de ven wrote:
Hi,

AFAIK this mode of operation is not currently supported and it would take new development to make things (optionally) work this way. Please feel free to open a feature request on GitHub to discuss it:

       Issues · bokeh/bokeh · GitHub

However, if your interest is in restoring the original plot bounds, perhaps the "reset" tool is actually what you need?

Thanks,

Bryan

On Dec 22, 2016, at 12:24 PM, chupach <mathie...@gmail.com> wrote:

I am using wheel_zoom (x-axis) and did set boundaries (on the x-axis).

After zooming in, I'd like to get the plot back to both boundaries when zooming out.
But the zoom out stops as soon as one of the boundary is reached.

Any way to customise so that zoom out does not stop until the second boundary is reached ?

Thx for any tips.

--
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/7cb9250f-b840-48cb-88aa-a74ae22ffafc%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/66c004f9-38ca-4e69-b44f-4c2234f46d40%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/5E8D90DB-5771-41E2-B970-824EC5A25496%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