KansaiRobot
KansaiRobot

Reputation: 9912

Plotly Hiding the trace initially

I know by reading the documentation that it is possible to hide some traces initially.

The docs give us this example

import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(go.Scatter(
    x=[1, 2, 3, 4, 5],
    y=[1, 2, 3, 4, 5],
))

fig.add_trace(go.Scatter(
    x=[1, 2, 3, 4, 5],
    y=[5, 4, 3, 2, 1],
    visible='legendonly'
))

fig.show()

That is good. However I am creating a plot with several scatter plots done in a loop so I need to set some visible and some not. For invisible it is visible='legendonly' but what can I write for visible? (I know that not writing anything does the trick but since it is going to be a loop, it would be nice to set it to something.

Upvotes: 6

Views: 5955

Answers (1)

KansaiRobot
KansaiRobot

Reputation: 9912

I just found out that the three possible values for visible are True, False and 'legendonly'

Upvotes: 6

Related Questions