import plotly.express as px
gapminder = px.data.gapminder()
gapminder.head()
读取前5行数据
fig = px.scatter(data_frame=gapminder,
x='gdpPercap',
y='lifeExp',
color='continent',
animation_frame='year',
log_x=True,
hover_name='country',
title='人均寿命和GDP. 1952 - 2007',
labels={'gdpPercap': '人均GDP',
'lifeExp': '平均寿命'},
size='pop',
size_max=90,
facet_col='continent',
range_y=[20, 100],
height=600,
width=1300)
fig.show()
图像显示为: