python使用Plotly实现动画设计

345次阅读
没有评论

python使用Plotly实现动画设计

python使用Plotly实现动画设计

1、呈现动画散点图

绘画散点图的图表是:scatter

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

输出效果

python使用Plotly实现动画设计

2、动画条形图

import plotly.express as px

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

输出效果

python使用Plotly实现动画设计

神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试

相关文章:

版权声明:wuyou2021-05-05发表,共计538字。
新手QQ群:570568346,欢迎进群讨论 Python51学习