Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

How to catch trace visibility changed?

Dear all,

I am working on an animated scatter plot project, where I manually modify the traces visibility, setting all other traces to ‘legendonly’ when a new trace is added to all frames.

This works fine, but when I now want to change the trace visibility by clicking on the legend, only the currently displayed data frame changes, sliding through the other frames keeps the previously manually set visibility states.

Is there an event fired, when the user interacts with the legend or any other way I can catch this event, so that I can adapt the other frames accordingly?

Thank you for your help.

Best regards,
Lisa

Listening to plotly_restyle should do the trick: https://codepen.io/etpinard/pen/QMZMed?editors=0010

1 Like

Awesome, short and easy solution.
Thanks a lot @etienne!