Black Lives Matter. Please consider donating to Black Girls Code today.

Animated bar chart (python)

Hi
I am trying to create an animated bar chart (plotly.express) where my bar chart is build up step by step. Eg.: In my current animation the bars for 1952 disappears when the bars for 1957 are shown . I want the bars for 1952 to stay (in addition to 1957 and 1962). Is this possible ? What am I missing ?

Here is my test data and code

df = pd.read_csv(“test.csv”)

fig = px.bar(df, x=“year”, y=“pop”, color=“country”,
animation_frame=“year”,
animation_group=“country”,
range_y=[0,10], range_x= [1950, 1965] ,
barmode = “group”,
)

fig.show()

Test Data (test.csv)

index,country,continent,year,pop
0,A,A1,1952,1
1,A,A2,1957,2
2,A,A3,1962,3
3,B,A1,1952,4
4,B,A2,1957,5
5,B,A3,1962,6
6,C,A1,1952,7
7,C,A2,1957,8
8,C,A3,1962,9

Thank you very much for your help !