Search code examples
pythonplotly

plotly animation disable auto play


Is it possible to disable the auto play when saving an animated plot created with plotly?

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]).write_html('anim.html')        

When I open anim.html, the animation starts automatically. I can stop it by pressing stop, but would like to change the default behavior.


Solution

  • Yes it should be possible to set autoplay to false.

    log_x=True, size_max=55, range_x=[100,100000], range_y=[25,90]).write_html('anim.html', autoplay=False)