Bijan
1
Hi there
We know that legends on Plotly can be turn off or on. When we plot, we can turn off data using legends and turn them on again.
I need that initially when the plot becomes appear, the legends be off and user if want to see them turn them on. How can I do it?
AIMPED
2
Hi,
you mean like this?
import plotly.graph_objs as go
fig=go.Figure()
fig.add_scatter(y=[1, 1, 1], line={'color': 'red'},name='Firsttrace')
fig.add_scatter(y=[2, 2, 2], line={'color': 'blue'},name='Secondttrace')
fig.add_scatter(y=[3, 3, 3], line={'color': 'black'},name='Thirdtrace')
fig.add_scatter(y=[4, 4, 4], line={'color': 'gold'},name='Forthtrace', visible='legendonly');
The last trace is not shown in the chart but is shown in the legend.
3 Likes
Bijan
3
Dear @AIMPED
That was exactly what I needed. Thanks
1 Like
matan3
4
Is there a plotly express equivalent? or we should use this underlying api for this effect?