Zooming like pyqtgraph [Feature Inquiry]

Hello,

TL; DR:

How difficult would it be to enable the x/y “zooming model” of pyqtgraph with bokeh?

The way it works in pyqtgraph is you hold down the right-mouse button, and then…

  • mouse moves RIGHT = zoom IN x-axis

  • mouse moves LEFT = zoom OUT x-axis

  • mouse moves UP = zoom IN y-axis

  • mouse moves DOWN = zoom OUT y-axis

It’s incredibly useful. Recently I’ve been thinking this a lot: “I never want to box-zoom again (if I can help it).”

Background Context:

I’ve recently started working on with some data where each piece of data is about 10 x/y time series, and they can be anywhere from 200k pts to 10M pts long. I’ve been looking at my options for plotting 10M points smoothly and holoviews and bokeh is extremely appealing. I’m very impressed with the performance. For my data analysis needs, it’s nearly perfect. The last important piece is seeing if I can get holoviews/bokeh to use this “zooming model” for lack of a better term.

To be clear, this “zooming model” pretty much requires catching a key-press or mouse-click to engage this zooming - that’s part of why it’s so effective. In pyqtgraph, left-mouse pans, right-mouse zooms; it’s really a nice way to explore 2D data.

Also, is this the right place to put this type of inquiry? I almost posted an issue on github, but wasn’t sure if bokeh devs only wanted true bugs to be filed in issues.

Many thanks,

Dave

Hi,

This is a good place to start. We like to reserve GH for bug reports and feature requests, and it's not clear to me that this needs to be something directly added to the library (BokehJS is already quite large, as JavaScript libraries go, we have to be considerate when adding to it). But also because there are definitely ways to accomplish this without building things into the core library.

Bokeh is extensible. It is possible to create your own custom extensions, including tools, that behave and are usable just like built-in Bokeh models:

  https://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html

I mention this approach first because you said you would need access to key events. If you need key events then a custom extension is the only way to go. There is an example of a custom tool in the chapter.

If you don't need key events (I don't quite see how it they are required from your initial description of mouse only moves) then a simpler possibility might to to make JS (or Python) callbacks to handle bokeh.events.Pan:

  https://bokeh.pydata.org/en/latest/docs/reference/events.html#bokeh.events.Pan

Some examples are here:
  
* javascript: https://github.com/bokeh/bokeh/blob/master/examples/howto/js_events.py

* python: https://github.com/bokeh/bokeh/blob/master/examples/howto/events_app.py

Thanks,

Bryan

···

On Jun 18, 2018, at 08:44, [email protected] wrote:

Hello,

TL; DR:
How difficult would it be to enable the x/y "zooming model" of pyqtgraph with bokeh?

The way it works in pyqtgraph is you hold down the right-mouse button, and then...
* mouse moves RIGHT = zoom IN x-axis
* mouse moves LEFT = zoom OUT x-axis
* mouse moves UP = zoom IN y-axis
* mouse moves DOWN = zoom OUT y-axis

It's incredibly useful. Recently I've been thinking this a lot: "I never want to box-zoom again (if I can help it)."

Background Context:
I've recently started working on with some data where each piece of data is about 10 x/y time series, and they can be anywhere from 200k pts to 10M pts long. I've been looking at my options for plotting 10M points smoothly and holoviews and bokeh is extremely appealing. I'm very impressed with the performance. For my data analysis needs, it's nearly perfect. The last important piece is seeing if I can get holoviews/bokeh to use this "zooming model" for lack of a better term.

To be clear, this "zooming model" pretty much requires catching a key-press or mouse-click to engage this zooming - that's part of why it's so effective. In pyqtgraph, left-mouse pans, right-mouse zooms; it's really a nice way to explore 2D data.

Also, is this the right place to put this type of inquiry? I almost posted an issue on github, but wasn't sure if bokeh devs only wanted true bugs to be filed in issues.

Many thanks,
Dave

--
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/08bf0a72-94ba-4b3b-bb04-45fe1631b171%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Bryan,

Thanks for the quick reply and the links!

From a UI standpoint, a key-press-and-hold or a mouse-click-and-hold seems required.

In my mind, a key-press and a mouse-click are very similar to the user, but they might be handled very differently in source code.

Does capturing right-click-and-hold require key events?

Thanks again!

···

On Monday, June 18, 2018 at 12:34:14 PM UTC-4, Bryan Van de ven wrote:

Hi,

This is a good place to start. We like to reserve GH for bug reports and feature requests, and it’s not clear to me that this needs to be something directly added to the library (BokehJS is already quite large, as JavaScript libraries go, we have to be considerate when adding to it). But also because there are definitely ways to accomplish this without building things into the core library.

Bokeh is extensible. It is possible to create your own custom extensions, including tools, that behave and are usable just like built-in Bokeh models:

    [https://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html](https://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html)

I mention this approach first because you said you would need access to key events. If you need key events then a custom extension is the only way to go. There is an example of a custom tool in the chapter.

If you don’t need key events (I don’t quite see how it they are required from your initial description of mouse only moves) then a simpler possibility might to to make JS (or Python) callbacks to handle bokeh.events.Pan:

    [https://bokeh.pydata.org/en/latest/docs/reference/events.html#bokeh.events.Pan](https://bokeh.pydata.org/en/latest/docs/reference/events.html#bokeh.events.Pan)

Some examples are here:

Thanks,

Bryan

On Jun 18, 2018, at 08:44, dave.[email protected] wrote:

Hello,

TL; DR:

How difficult would it be to enable the x/y “zooming model” of pyqtgraph with bokeh?

The way it works in pyqtgraph is you hold down the right-mouse button, and then…

  • mouse moves RIGHT = zoom IN x-axis
  • mouse moves LEFT = zoom OUT x-axis
  • mouse moves UP = zoom IN y-axis
  • mouse moves DOWN = zoom OUT y-axis

It’s incredibly useful. Recently I’ve been thinking this a lot: “I never want to box-zoom again (if I can help it).”

Background Context:

I’ve recently started working on with some data where each piece of data is about 10 x/y time series, and they can be anywhere from 200k pts to 10M pts long. I’ve been looking at my options for plotting 10M points smoothly and holoviews and bokeh is extremely appealing. I’m very impressed with the performance. For my data analysis needs, it’s nearly perfect. The last important piece is seeing if I can get holoviews/bokeh to use this “zooming model” for lack of a better term.

To be clear, this “zooming model” pretty much requires catching a key-press or mouse-click to engage this zooming - that’s part of why it’s so effective. In pyqtgraph, left-mouse pans, right-mouse zooms; it’s really a nice way to explore 2D data.

Also, is this the right place to put this type of inquiry? I almost posted an issue on github, but wasn’t sure if bokeh devs only wanted true bugs to be filed in issues.

Many thanks,

Dave


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/08bf0a72-94ba-4b3b-bb04-45fe1631b171%40continuum.io.

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

Hi,

The high level python bokeh.events API does not support keypress events. (I'm not interested in making it trivial e.g. to create a surreptitious keylogger.) If you want to handle key events, that is possible, but you have to handle things at the JavaScript level in a custom extension.

Thanks,

Bryan

···

On Jun 18, 2018, at 10:19, Dave C <[email protected]> wrote:

Hi Bryan,

Thanks for the quick reply and the links!

From a UI standpoint, a key-press-and-hold or a mouse-click-and-hold seems required.
In my mind, a key-press and a mouse-click are very similar to the user, but they might be handled very differently in source code.
Does capturing right-click-and-hold require key events?

Thanks again!

On Monday, June 18, 2018 at 12:34:14 PM UTC-4, Bryan Van de ven wrote:
Hi,

This is a good place to start. We like to reserve GH for bug reports and feature requests, and it's not clear to me that this needs to be something directly added to the library (BokehJS is already quite large, as JavaScript libraries go, we have to be considerate when adding to it). But also because there are definitely ways to accomplish this without building things into the core library.

Bokeh is extensible. It is possible to create your own custom extensions, including tools, that behave and are usable just like built-in Bokeh models:

        https://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html

I mention this approach first because you said you would need access to key events. If you need key events then a custom extension is the only way to go. There is an example of a custom tool in the chapter.

If you don't need key events (I don't quite see how it they are required from your initial description of mouse only moves) then a simpler possibility might to to make JS (or Python) callbacks to handle bokeh.events.Pan:

        https://bokeh.pydata.org/en/latest/docs/reference/events.html#bokeh.events.Pan

Some examples are here:
         
* javascript: https://github.com/bokeh/bokeh/blob/master/examples/howto/js_events.py

* python: https://github.com/bokeh/bokeh/blob/master/examples/howto/events_app.py

Thanks,

Bryan

> On Jun 18, 2018, at 08:44, [email protected] wrote:
>
> Hello,
>
> TL; DR:
> How difficult would it be to enable the x/y "zooming model" of pyqtgraph with bokeh?
>
> The way it works in pyqtgraph is you hold down the right-mouse button, and then...
> * mouse moves RIGHT = zoom IN x-axis
> * mouse moves LEFT = zoom OUT x-axis
> * mouse moves UP = zoom IN y-axis
> * mouse moves DOWN = zoom OUT y-axis
>
> It's incredibly useful. Recently I've been thinking this a lot: "I never want to box-zoom again (if I can help it)."
>
> Background Context:
> I've recently started working on with some data where each piece of data is about 10 x/y time series, and they can be anywhere from 200k pts to 10M pts long. I've been looking at my options for plotting 10M points smoothly and holoviews and bokeh is extremely appealing. I'm very impressed with the performance. For my data analysis needs, it's nearly perfect. The last important piece is seeing if I can get holoviews/bokeh to use this "zooming model" for lack of a better term.
>
> To be clear, this "zooming model" pretty much requires catching a key-press or mouse-click to engage this zooming - that's part of why it's so effective. In pyqtgraph, left-mouse pans, right-mouse zooms; it's really a nice way to explore 2D data.
>
> Also, is this the right place to put this type of inquiry? I almost posted an issue on github, but wasn't sure if bokeh devs only wanted true bugs to be filed in issues.
>
> Many thanks,
> Dave
>
> --
> 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/08bf0a72-94ba-4b3b-bb04-45fe1631b171%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 [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/59fa6d25-15cd-4446-8daa-fee2925ce9ff%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.