Remove Selection box from plot in ipywidgets as soon as selection is made

Hi All,

I am building an interactive dashboard using plotly and ipywidgets and the dashboard contains multiple FigureWidget objects as well as dropdowns, buttons etc. Unfortunately I have run into a frustrating issue with the drag select tool.

I have included .on_selection events for all of my scatterplots and use these selection events to prompt other calculations. Because the drag select functionality is one of a few different ways to filter data in this dashboard, I would like the lines which bound the selection to disappear after the selection is made. If this does not happen, then the dashed lines persisting on the plot are quite misleading for the user.

I think in essence I want to have the behaviour of a double click post selection happen automatically. I have found an example which implements some of the behaviour I need in plotly.js at this link ( but I do not know how to apply this to python.

Any help to replicate the above example in python would be much appreciated.

Thanks in advance,

1 Like

@tomharr I have the exact same use case. I need the selection box to disappear after a selection is made. I’m using python and I can call code in the callback, but nothing I do seems to make the selection box ‘go away’. If you find any solution please post :slight_smile:

12 months later, any update on this. Did one of you find a solution or workaround ?