If you are displaying fig.frames
and see that each Frame.data
has set the color['marker']
, then you don’t have another faster solution than creating a loop. This means that the frame definition doesn’t update only the attributes of fig.data
that change from frame to frame, but also the constant value attributes.
Usually if the fig data is defined like in this example:
fig = go.Figure()
fig.add_scatter(x=np.arange(10),
y=1+3*np.random.rand(10),
marker_size=6, marker_color='red', line_color='blue') #trace of index 2
and we want in each frame to change only point positions, not other properties, then the frames are defined as follows
fig.frames = [go.Frame(data=[go.Scatter(y=2+3*np.random.rand(10))],
traces=[0]) for k in range(20)]
Adding in Frame defintion the same color like in the corresponding fig.data
is a superfluous setting.
I think that in the plotly express all fig.data
settings are repeated in Frame definition, for generality, to let users customize the fig appearance after its definition