As the title implies, is there a way to make an annotation dissapear/appear by clicking on the corresponding trace in the legend of a plotly chart?
Suppose I have a scatterplot with a nonlinear trendline I added with add_trace. The trendline has an entry in the legend box and I want to display/hide the equation for the trendline when I toggle the trace on/off in the legend box.
The annotations have a visible property that can be accessed, and I read about the layout.legend.itemclick but it only covers the events of the affected trace, no option to include an object like an annotation.
Any way to do this? Thank you beforehand.