How to extract selection points in jupyter notebook plots

Hi,
I am doing quite an intense use of plotly in my data analysis framework. The analysis is built in order to run on jupyter notebooks since there is always the need to write custom code.
One thing that I am missing in order to have it fully functional is a way to graphically select the data. In principle when I do a plot I would need to draw some kind of closed shape (can be an irregular polygon) and then extract the vertices of the shape in order to apply a data cut.

The application of the data cut is done with some custom code due to our way of storing the data.

Could you give me any pointers on how i could extract such info from the plots?

Best