Python plotly - set traces equal except new trace has legend off

Viewed 47

I am currently trying to create a new trace based on an old trace except I want the second trace to have the legend off. The code for trace 1 is:

import plotly.graph_objs as go

trace = go.Scatter(
    x=x,
    y=y,
    mode='lines',
    name='INC',
    line = dict(
        color = ('rgb(0,153,255)'),
        )
)

How can I create trace2 such that it is equal to trace except it includes showlegend=false ? Essentially, I want trace2 to be:

trace2 = go.Scatter(
        x=x,
        y=y,
        mode='lines',
        name='INC',
        showlegend=false,
        line = dict(
            color = ('rgb(0,153,255)'),
            )
    )

I have to do this for several traces. Is there a shortcut I could use after typing trace2=trace that would be equivalent? Thank you

1 Answers
Related