Is it possible to animate a Bar chart so that each bar appears in the animation sequentially?
For example, in the image above, I want for each frame, a new bar to show up but I don’t want the previously rendered ones to disappear thus if I’m at frame 5 then I’d like to show all the bars until that frame.
requests_df = pd.DataFrame({'requests': total_requests})
fig = go.Figure(data = [go.Bar(x=requests_df.index.tolist(), y=requests_df['requests'])],
frames=[
go.Frame(data=[go.Bar(x=requests_df.index.tolist(), y=requests_df['requests'])])]
)
fig.show()
total_requests
is a variable with values ranging from tens to hundreds of millions and I used that to create a dataframe since I was trying to make it more convenient in a way to use. Basically, the dataframe looks like this
requests | |
---|---|
0 | 214388438.0 |
1 | 194980303.0 |
2 | 179475934.0 |
3 | 165196540.0 |
4 | 154815540.0 |
5 | 123650671.0 |
…
At first, I tried to accomplish this using express
but my attempts did not work out so I started experimenting with go.Figure
objects.