I have created an animated graph but the transitions are very choppy and oscillate wildly. Is there a particular transition setting or tweak that I can make to rectify this? When I manually slide the slider itās much smoother and looks much better but is still not perfect. So it seems that I first need to fix the Play button animation and then somehow smooth out the transitions. Iād appreciate any feedback on how to best do that. Hereās the section of code I use to build the frames:
frames_voronoi_team1 = [go.Frame(
data=[go.Scatter(
x=group['v_vor_x'],
y=group['v_vor_y'],
mode="lines",
marker=dict(color='black', size=1),
fill="toself",
fillcolor=colour0,
opacity=.25,
name="Voronoi_1")
]) for name, group in grouped_voronoi_team1]
frames_voronoi_team2 = [go.Frame(
data=[go.Scatter(
x=group['v_vor_x'],
y=group['v_vor_y'],
mode="lines",
marker=dict(color='black', size=1),
fill="toself",
fillcolor=colour1,
opacity=.25,
name="Voronoi_2")
]) for name, group in grouped_voronoi_team2]
# Add the frames to the figure
fig4 = go.Figure(data=go.Scatter(mode='lines', fill='toself', line=dict(width=1), visible = "legendonly"),
# legendonly hides it initially
layout=go.Layout(
xaxis=dict(range=[-6, 115], autorange=False, zeroline=False),
yaxis=dict(range=[-6, 76], autorange=False, zeroline=False),
hovermode="closest",
transition={'duration': 0, 'easing': 'linear', 'ordering': 'traces first'},
updatemenus=[dict(type='buttons',
buttons=[dict(label='Play',
method='animate',
args=[None,
dict(frame=dict(duration=100,
redraw=False),
transition=dict(duration=0),
fromcurrent=True,
mode='immediate')
])
])]
),
frames=frames_voronoi_team1
)
fig5 = go.Figure(data=go.Scatter(mode='lines', fill='toself', line=dict(width=1), visible = "legendonly"),
# legendonly hides it initially
layout=go.Layout(
xaxis=dict(range=[-6, 115], autorange=False, zeroline=False),
yaxis=dict(range=[-6, 76], autorange=False, zeroline=False),
hovermode="closest",
transition={'duration': 0, 'easing': 'linear', 'ordering': 'traces first'},
updatemenus=[dict(type='buttons',
buttons=[dict(label='Play',
method='animate',
args=[None,
dict(frame=dict(duration=100,
redraw=False),
transition=dict(duration=0),
fromcurrent=True,
mode='immediate')
])
])]
),
frames=frames_voronoi_team2
)
# Add each figure's data to the main figure via a trace for each.
fig.add_trace(fig4.data[0])
for i, frame in enumerate(fig.frames):
fig.frames[i].data += (fig4.frames[i].data[0],)
fig.add_trace(fig5.data[0])
for i, frame in enumerate(fig.frames):
fig.frames[i].data += (fig5.frames[i].data[0],)