Selecting zero points in scatter plot?

If zero points from a glyph are selected on scatter figure (with, e.g., the box select tool), then that seems to turn into all of them selected. This is undesirable in my case because I am plotting multiple glyphs at once, and so sometimes may want to select only one kind of point. But if I do that, the glyph I don’t want becomes all selected. Is there a way to change this behavior?

Thanks,

Tim

Hello, as far as I know this is only visual. It’s just that if you have 0 points of a a given glyph in the selection, they won’t have their alpha/color changed and thus appear as if selected. But if you use look at the selected indices in a callback it will correctly see no selected points.

This is correct. Selection "no points" results in an empty selection, which is the same as every point being displayed as "normal" (i.e. when the plot first opens). Accordingly, the plot draws exactly as it does when no points are selected. I'm not sure what a reasonable alternative behavior would be.

Thanks,

Bryan

···

On Jun 20, 2017, at 14:48, [email protected] wrote:

Hello, as far as I know this is only visual. It's just that if you have 0 points of a a given glyph in the selection, they won't have their alpha/color changed and thus appear as if selected. But if you use look at the selected indices in a callback it will correctly see no selected points.

--
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/6fc45c67-f912-4eeb-ac95-03a06152e203%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

The root of the issue is that I am plotting multiple types of points, want to select subsets of them, and then use those selections in figures showing histograms (with different colors for each type of point). I’m getting this selection issue because I am implementing this using multiple glyphs (and multiple DataSources). I think I would avoid this problem (though perhaps create others) if I could just use a single glyph/DataSource. However, I understood the resolution of this thread pointed me towards using multiple glyphs. Another important feature I need is the ability to turn on and off the different glyphs using the interactive legend. Any suggestions?

···

On Tuesday, June 20, 2017 at 3:55:54 PM UTC-4, Bryan Van de ven wrote:

This is correct. Selection “no points” results in an empty selection, which is the same as every point being displayed as “normal” (i.e. when the plot first opens). Accordingly, the plot draws exactly as it does when no points are selected. I’m not sure what a reasonable alternative behavior would be.

Thanks,

Bryan

On Jun 20, 2017, at 14:48, [email protected] wrote:

Hello, as far as I know this is only visual. It’s just that if you have 0 points of a a given glyph in the selection, they won’t have their alpha/color changed and thus appear as if selected. But if you use look at the selected indices in a callback it will correctly see no selected points.


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/6fc45c67-f912-4eeb-ac95-03a06152e203%40continuum.io.

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

Wouldn’t it be better if all the non selected points were set to the default low alpha blue?

The issue is that I’m using the selected points in a callback that updates another figure. If I select points in only one of the glyphs (the two types of points often occupy different regions of the scatter plot), then it treats all of the other type of glyph as being selected, which is no good for my purposes.

···

On Tuesday, June 20, 2017 at 4:17:39 PM UTC-4, Sébastien Roche wrote:

Wouldn’t it be better if all the non selected points were set to the default low alpha blue?

Just to say another few words, I want my callback to plot a histogram of the selected points. The way I’ve been doing this is by using the ‘selected’ attribute (one glyph at a time), and if none are selected, then making a histogram of all the points. Perhaps the solution is to add more logic to the callback to find out if any of the glyphs have any selections or not, and create the histograms accordingly, but I’m also open to other suggestions.

···

On Tuesday, June 20, 2017 at 4:33:00 PM UTC-4, Tim Morton wrote:

The issue is that I’m using the selected points in a callback that updates another figure. If I select points in only one of the glyphs (the two types of points often occupy different regions of the scatter plot), then it treats all of the other type of glyph as being selected, which is no good for my purposes.

On Tuesday, June 20, 2017 at 4:17:39 PM UTC-4, Sébastien Roche wrote:

Wouldn’t it be better if all the non selected points were set to the default low alpha blue?

By default, selection tools apply to all renderers. But you can limit selection tools to act on just a subset of renderers, see e.g.

  http://bokeh.pydata.org/en/latest/docs/reference/models/tools.html#bokeh.models.tools.BoxSelectTool.renderers

I'm currently swamped and can't tell from a glance here whether that will help your situation for sure, but it seems plausible that it might.

Thanks,

Bryan

···

On Jun 20, 2017, at 15:40, Tim Morton <[email protected]> wrote:

Just to say another few words, I want my callback to plot a histogram of the selected points. The way I've been doing this is by using the 'selected' attribute (one glyph at a time), and if none are selected, then making a histogram of all the points. Perhaps the solution is to add more logic to the callback to find out if *any* of the glyphs have any selections or not, and create the histograms accordingly, but I'm also open to other suggestions.

On Tuesday, June 20, 2017 at 4:33:00 PM UTC-4, Tim Morton wrote:
The issue is that I'm using the selected points in a callback that updates another figure. If I select points in only one of the glyphs (the two types of points often occupy different regions of the scatter plot), then it treats *all* of the other type of glyph as being selected, which is no good for my purposes.

On Tuesday, June 20, 2017 at 4:17:39 PM UTC-4, Sébastien Roche wrote:
Wouldn't it be better if all the non selected points were set to the default low alpha blue?

--
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/3de96d97-3190-4f17-aa46-dc0515f4710f%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.