Defining custom tools in Bokeh

Setup:

I have two-dimensional data I want to plot, similar to the ‘scatter’ example from the tutorial.
The Bokeh tools such as the pan feature are useful, but I’d like to be able to add more functionality.
For example, I want to be able to take 1D cuts (horizontal and vertical) of the data and plot the selected cut separately.
What I have in mind is an additional tool, which would select the cut based on the last click in the window, or a similar feature.
Is there a way for me to define custom tools, such as the one outlined here? If not, what approach would you suggest for such issues?

Thanks!

It seems lots of people are interested in this at once! I am actually working on a Pull Request for improved tools and selections now:

  selection manager and tools/events refactor by bryevdv · Pull Request #1244 · bokeh/bokeh · GitHub

Hoping to merge this in a couple of days, and I will update the mailing list with more information (and a dev build to try out) after this work is merged to master.

Bryan

···

On Sep 28, 2014, at 5:11 PM, [email protected] wrote:

Setup:

I have two-dimensional data I want to plot, similar to the 'scatter' example from the tutorial.
The Bokeh tools such as the pan feature are useful, but I'd like to be able to add more functionality.
For example, I want to be able to take 1D cuts (horizontal and vertical) of the data and plot the selected cut separately.
What I have in mind is an additional tool, which would select the cut based on the last click in the window, or a similar feature.
Is there a way for me to define custom tools, such as the one outlined here? If not, what approach would you suggest for such issues?

Thanks!

--
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/3485d066-5783-4481-94f2-44973f6eacdb%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

That sounds great!

I also agree with the philosophy on decoupling the roles of tools / renderers / selectors you mention on GitHub. A cleaner decoupling would likely allow for more functionality, without too much additional complexity for the user.

···

On Sunday, September 28, 2014 3:15:35 PM UTC-7, Bryan Van de ven wrote:

It seems lots of people are interested in this at once! I am actually working on a Pull Request for improved tools and selections now:

    [https://github.com/ContinuumIO/bokeh/pull/1244](https://github.com/ContinuumIO/bokeh/pull/1244)

Hoping to merge this in a couple of days, and I will update the mailing list with more information (and a dev build to try out) after this work is merged to master.

Bryan

On Sep 28, 2014, at 5:11 PM, [email protected] wrote:

Setup:

I have two-dimensional data I want to plot, similar to the ‘scatter’ example from the tutorial.

The Bokeh tools such as the pan feature are useful, but I’d like to be able to add more functionality.

For example, I want to be able to take 1D cuts (horizontal and vertical) of the data and plot the selected cut separately.

What I have in mind is an additional tool, which would select the cut based on the last click in the window, or a similar feature.

Is there a way for me to define custom tools, such as the one outlined here? If not, what approach would you suggest for such issues?

Thanks!


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/3485d066-5783-4481-94f2-44973f6eacdb%40continuum.io.

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

This is definitely the idea, and I have and success with a very similar architecture in previous projects. For the curious, here some notes about the ongoing work:

* simplified events dispatch, wrapping (hammer.js + jq_mousewheel)
  - should get us some preliminary touch support as a bonus!

* allow multiple active "action" tools
  - action tools have their own button on the toolbar
  - one active per "type" of non-conflicting event: pan, tap, wheel, pinch, etc
  - action tools include "selector" tools
  - action tools optionally have a key that activates them

* allow unlimited active "inspector" tools
  - inspectors active state toggle-able in a toolbar dropdown
  - these respond only to mouse moves

* selectors and inspectors just report a geometry to a selection manager

* selection manager queries renderers for hit indices using geometry
  - omitting some detail about a Selector class that manages multi-select, etc.

* selection manager reports/saves selection results on data sources

* anything can listen to/respond to these selection events
  - tools
  - annotations (including newly factored tooltip annotation)
  - running user code, through a bokeh-server

After this plumbing is all in place, the major remaining parts to flesh it out are:

* add remaining hit tests for additional geometries to renderers
  - "rect", "line", "poly" hit-testing

* add some new tools to report these geometries
  - poly selection
  - lasso tool

* add some new annotations that repond to inspections/selections
  - improve hover to support creating multiple tooltips
  - axis "position" tooltip that responds to mouse position
  - whatever else people think of! :slight_smile:

The nice thing is all of the above can be done in a piecemeal fashion once the initial work is done.

Hope this is interesting/helps. If anyone is interested in pitching in with any of this, please don't hesitate to reach out!

Bryan

···

On Sep 28, 2014, at 5:36 PM, [email protected] wrote:

That sounds great!

I also agree with the philosophy on decoupling the roles of tools / renderers / selectors you mention on GitHub. A cleaner decoupling would likely allow for more functionality, without too much additional complexity for the user.

On Sunday, September 28, 2014 3:15:35 PM UTC-7, Bryan Van de ven wrote:
It seems lots of people are interested in this at once! I am actually working on a Pull Request for improved tools and selections now:

        selection manager and tools/events refactor by bryevdv · Pull Request #1244 · bokeh/bokeh · GitHub

Hoping to merge this in a couple of days, and I will update the mailing list with more information (and a dev build to try out) after this work is merged to master.

Bryan

On Sep 28, 2014, at 5:11 PM, ronald....@gmail.com wrote:

> Setup:
>
>
> I have two-dimensional data I want to plot, similar to the 'scatter' example from the tutorial.
> The Bokeh tools such as the pan feature are useful, but I'd like to be able to add more functionality.
> For example, I want to be able to take 1D cuts (horizontal and vertical) of the data and plot the selected cut separately.
> What I have in mind is an additional tool, which would select the cut based on the last click in the window, or a similar feature.
> Is there a way for me to define custom tools, such as the one outlined here? If not, what approach would you suggest for such issues?
>
>
> Thanks!
>
> --
> 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/3485d066-5783-4481-94f2-44973f6eacdb%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/ef26c019-158d-4663-a36d-a8dbcad674ac%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.