Keeping BoxSelectTool area selection box after mouse keyup

I have a heatmap chart, using rect, that connected to other chart.

When using BoxSelectTool to select area, the selected area shown on the other chart.

All works fine.

By default, Bokeh makes unselected rects transparent, but I don’t want it.
What I want is to keep the squared selected area shown on the chart.

Is there a way to achieve it without drawing a new glyph manually?

If not, what is the best approach to draw a square on the area using the indices from the selection event?

Thank you!

Is there a way to achieve it without drawing a new glyph manually?

I don’t think so.

what is the best approach to draw a square on the area using the indices from the selection event?

Create a data source, attach it to a rect glyph, edit the data source according to the selection.

Also check out BoxEditTool - maybe it will be easier to use it instead: https://docs.bokeh.org/en/latest/docs/user_guide/tools.html#boxedittool

1 Like