Basic charts#

Documentation:
https://plotly.com/python/basic-charts/

import plotly.express as px

Scatter plot#

Use gapminder data.

just_2002_filter = ( px.data.gapminder()['year']==2002 )
just_2002 = px.data.gapminder()[just_2002_filter]
just_2002.head()
country continent year lifeExp pop gdpPercap iso_alpha iso_num
10 Afghanistan Asia 2002 42.129 25268405 726.734055 AFG 4
22 Albania Europe 2002 75.651 3508512 4604.211737 ALB 8
34 Algeria Africa 2002 70.994 31287142 5288.040382 DZA 12
46 Angola Africa 2002 41.003 10866106 2773.287312 AGO 24
58 Argentina Americas 2002 74.340 38331121 8797.640716 ARG 32

Look at the relationship between GDP per capita and life expectancy in 2002.

scatter_2002 = px.scatter(
	data_frame=just_2002,
	x='gdpPercap',
	y='lifeExp',
)
scatter_2002