• 技术文章 >Python技术 >Python基础教程

    python使用Plotly实现动画设计

    宋雪维宋雪维2021-02-23 16:20:02原创2109

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

    输出效果

    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基础
    品易云
    上一篇:python如何应用于数据的基础统计分析 下一篇:python中Plotly Express是什么?

    相关文章推荐

    • Python之PyArmadillo计算库的产生• python中@是什么意思• Python Vlookup函数的查询

    全部评论我要评论

    © 2021 Python学习网 苏ICP备2021003149号-1

  • 取消发布评论
  • 

    Python学习网