Dear all,
I really like this
Dear all,
I really like this animation and would like to achieve a similar animation, however with the decades on the x-axis:
import plotly.express as px
df = px.data.gapminder()
fig = px.bar(df, x="continent", y="pop", color="continent",
animation_frame="year", animation_group="country", range_y=[0,4000000000])
fig.show()
When I add decades to take the place of the “continents”, the animation only shows the decade of the current year.
gap = px.data.gapminder()
cut_bins = np.arange(1950,2010,10).tolist()
cut_labels = [f"{year}s" for year in range(1950, 2000, 10)]
gap['decade'] = pd.cut(gap['year'], bins=cut_bins, labels=cut_labels)
fig = px.bar(gap, x="decade", y="pop", color="continent",
animation_frame="year", animation_group="country", range_y=[0,4000000000])
fig.show()
Does anybody have an idea how to get all decades on the x-axis so that the values move up as in the example above?