Multiple brushes on a single plot

I’m trying to enable multiple brushed regions on a plot that is linked.
So for example brush one area, then brush another area, maybe with a different highlight color. Is this possible?

Thanks!

Hi Allan,

Have you tried holding Shift? The example at https://bokeh.pydata.org/en/latest/docs/user_guide/examples/interaction_linked_brushing.html works for me with Shift just fine.

Setting a different color for each selected segment is much trickier though. I think you’ll have to explicitly set a selection glyph identical to the main glyph, except that it uses a separate column in a data source for the fill color.

Then, you’ll have to listen to “select” signal of the data source and choose newly selected points’ indices yourself, and then patch the data in the data source in the selection glyph fill color.

Another, more involved but arguably a bit more clear way would be to extend ColumnDataSource and use a custom SelectionManager that has, oh boy, a custom Selector that does some magic inside its “update” method.

Regards,

Eugene

···

On Friday, October 13, 2017 at 4:49:39 AM UTC+7, Allan wrote:

I’m trying to enable multiple brushed regions on a plot that is linked.
So for example brush one area, then brush another area, maybe with a different highlight color. Is this possible?

Thanks!