Hello,
Iโm trying to make a functional plot where I am using two plots. So far it looks like this:
Now, I want to make both plots to be animated, so that every frame the state changes in both. Currently, only the BarPolar is being animated.
Iโve attempted to animate the bar chart below so that for each frame a another bar is added, it starts as 1 and then for each frame a new bar is added while preserving the ones rendered in previous frame. So far I failed to do so, itโs not consistent with what I wanted to achieve. In the sense that the Barpolar changes its state as it should, but the barchart is either one single bar that is as wide as the whole barchart then it disappears and so on.
Some of my attempts with animating the bar chart:
Code:
trace2 = go.Bar(name="Traffic Requests", x=[requests_df.loc[0]['frame']], y=[requests_df.loc[0]['requests']], opacity=0.15)
frames=[dict(name=str(k),
data=[go.Barpolar(r=test_df.loc[k]['scaled_bidrates'],
theta=test_df.loc[k]['theta'],
width=test_df.loc[k]['angles'].tolist(),
marker={"color": test_df.loc[k]['winrate']},
customdata=np.stack(
(labels.loc[k], factor_proportion.loc[k], winrates.loc[k], bidrates.loc[k]), axis=-1)),
go.Bar(x=[requests_df.loc[k]['frame']], y=[requests_df.loc[k]['requests']])
],
traces=[0, 1]
)
for k in range(len_df)
]
data = [trace1, trace2]
# add subplots to existing traces
fig = go.Figure(data=data, frames=frames).set_subplots(2, 1,
specs=[[{"type": "barpolar"}],
[{"type": "bar"}]])
*Trace 1 is theused for BarPolar, basically Iโm using a go.BarPolar
.
As for references I found these helpful:
https://chart-studio.plotly.com/~empet/15012/animating-subplots-with-more-than-one-t/#/
Can anyone help me figure this out?
Thanks!