Import your data
Country | Continent | GDP_per_capita | life_expectancy | Population | |
---|---|---|---|---|---|
0 | Afghanistan | Asia | 663 | 54.863 | 22856302 |
1 | Albania | Europe | 4195 | 74.200 | 3071856 |
2 | Algeria | Africa | 5098 | 68.963 | 30533827 |
3 | Angola | Africa | 2446 | 45.234 | 13926373 |
4 | Antigua and Barbuda | N. America | 12738 | 73.544 | 77656 |
Specify axis labels with pandas
When you plot, you get back an ax
element. It has a million and one methods,
two of which are set_xlabel
and set_ylabel
.
<matplotlib.text.Text at 0x10891db00>
Specify axis labels with matplotlib
Just to mix it up a bit, this time we’re going to use plt.subplots()
to create
a figure first. When we pull the GDP and life expectancy out of the dataframes
they just look like lists to the matplotlib
plotter.
<matplotlib.text.Text at 0x108170a90>