Set traces to be toggled off by default

Hi @jmillz, this is possible : graph_objects traces have a visible attribute which can be set to legendonly, and then you can click on the trace name in the legend if you want them to become visible. For example

import plotly.graph_objects as go
fig = go.Figure(go.Scatter(y=[1, 2, 3]))
fig.add_trace(go.Scatter(y=[3, 4, 5], visible='legendonly'))
fig.show()

In fact we should add an example using legendonly to https://plot.ly/python/legend/ (unless you want to contribute it yourself of course!).

2 Likes