Plotly animation

Hi I am trying to use Plotly v4.6. I am on VsCode with Python (Python code and jupyter integrated inside Vscode).
Everything is working when I tried website examples except when I tried to replicate the animated graph from the website. For example :

import plotly.express as px
df = px.data.gapminder()
px.scatter(df, x=“gdpPercap”, y=“lifeExp”, animation_frame=“year”, animation_group=“country”, size=“pop”, color=“continent”, hover_name=“country”, log_x=True, size_max=55, range_x=[100,100000], range_y=[25,90])

I can see the graph but nothing happens. No animation. When I click on the “Play” button or try to change the year on the bar nothing happens. I am stocked on the year 1952 (I can see it when I put the mouse on the bubbles).

I try to implement others examples from here plotly.com/python/animations. Same result. No animation but I can see the graph and all the buttons.

I have no error message. Nothing seems to be wrong.

Thx for your help.

1 Like

Is there any answer to my problem ?
Please help me !
I suppose there exist others people using vscode / Plotly

1 Like

hi, i have the same problem, did you resolve it?

hi, it works in this way:
This text will be blurred
import plotly.express as px
df = px.data.gapminder()
fig = px.scatter(df, x=“gdpPercap”, y=“lifeExp”, animation_frame=“year”, animation_group=“country”,
size=“pop”, color=“continent”, hover_name=“country”,
log_x=True, size_max=55, range_x=[100,100000], range_y=[25,90])

fig[“layout”].pop(“updatemenus”) # optional, drop animation buttons
fig.show(renderer=‘notebook’)

you can read more detail in the documentation https://plotly.com/python/renderers/

I switched to Jupiter lab to execute animated graph but your right : your solution works. It is strange because I tried it but with no success.
Thank you. I can switch back to vs code that I prefer.
Jacques.