plotly 动画禁用自动播放

问题描述 投票:0回答:1

保存使用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')        

当我打开

anim.html
时,动画会自动开始。我可以通过按停止来停止它,但想更改默认行为。

python plotly
1个回答
0
投票

是的,应该可以将自动播放设置为 false。

log_x=True, size_max=55, range_x=[100,100000], range_y=[25,90]).write_html('anim.html', autoplay=False)
© www.soinside.com 2019 - 2024. All rights reserved.