go.Scatter selection randomly not triggering
I'm using go.Scatter and its lasso selection to select points and further work with the returned indices.
However, this is unreliable. Most of the times the selection just doesn't do anything and I have to repeat it 1-5 times.
I think it gets more unreliable the bigger the total number of points is (but doesn't depend on the number of selected points).
I found this issue that might be connected, but couldn't translate it into a solution myself: https://github.com/zauberzeug/nicegui/issues/3762
Here is a somewhat minimal example.
4 Replies
I've turned it into a pycafe example:
https://py.cafe/maartenbreddels/solara-plotly-lasso-bug
And yes, it sometimes just dosn't work, and when it starts working, it continues to work for me.
I also had to use plotly < 6 for it to work. Newer plotly is using anywidget, maybe that implementation is more robust? Could you try if you can get that working?
PyCafe - Solara - Sometimes on_selection does not trigger
Create & Share Streamlit, Dash and Python Apps Online.
Just to update on the progress - I've opened a PR to Plotly's JS library to fix the issue you were having with using plotly 6 @MaartenBreddels. Will continue to look for what causes the inconsistencies in selections not triggering!
The rest of the Plotly 6 issues should be fixed when https://github.com/manzt/anywidget/pull/804 is released!
iisakkirotko
<:pull_open:882464248721182842> [manzt/anywidget] fix: comm messages were lost before model was loaded
As I explained in the related issue https://github.com/manzt/anywidget/issues/803, any comm messages sent to the widget before it's model was loaded were lost. This should ensure that those messages are also processed.
Fixes: https://github.com/manzt/anywidget/issues/803.
Created
Thanks for looking into it. I gave plotly 6 go yesterday but still couldn't get it to work either in my env or on pycafe. Anything specific I need to pay attention to?