画图工具包plotly使用

(1)越来越流行 plotly

(2)替换matplotlib

df = px.data.gapminder()
df_2007 = df.query("year==2007")
fig = px.scatter(df_2007, x="gdpPercap", y="lifeExp", color="continent", 
                 size="pop", size_max=50, hover_name="country",
                animation_frame="year", animation_group="country", log_x="True", labels=dict(pop="Population", dgpPercap="GDP per Capital", lifeExp="Life Expection"),
                range_x=[100, 100000], range_y=[25,90])
HTML(fig.to_html())

结果:

 

posted @ 2022-09-20 21:11  今夜无风  阅读(45)  评论(0编辑  收藏  举报