当前位置: 首页 > 图灵资讯 > 行业资讯> python使用Plotly实现动画设计

python使用Plotly实现动画设计

发布时间:2024-09-04 20:01:09

python使用plotly实现动画设计

1、呈现动画散点图

画散点图的图表如下:scatter

importplotly.expressaspx
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])

输出效果

2、动画条形图

importplotly.expressaspx

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()

输出效果

相关文章

如何让vim支持python3

如何让vim支持python3

2025-09-12
python2.7和3.6区别有哪些

python2.7和3.6区别有哪些

2025-09-12
python3有serial库吗

python3有serial库吗

2025-09-12
python中w、r表示什么意思

python中w、r表示什么意思

2025-09-12
python中如何把list变成字符串

python中如何把list变成字符串

2025-09-12
python命名空间是什么

python命名空间是什么

2025-09-12