Conteúdo do Curso
Visualization in Python with matplotlib
Visualization in Python with matplotlib
Group by Region
Swipe to show code editor
Let's build a new scatter plot with the same data, but this time painting the points with respect to the region (the 'continent'
column). Follow the next steps:
- Iterate over pair of
colors
andregions
, usingcolor
andregion
as dummy variables. - Within the loop, filter the observations to a particular continent (respective value of
region
variable). - Then, within the same loop, initialize a scatter plot of
'gdp per capita'
vs'life exp'
. Set color of points tocolor
and set thelabel
parameter toregion
. - Display the legend of the plot.
Obrigado pelo seu feedback!
Group by Region
Swipe to show code editor
Let's build a new scatter plot with the same data, but this time painting the points with respect to the region (the 'continent'
column). Follow the next steps:
- Iterate over pair of
colors
andregions
, usingcolor
andregion
as dummy variables. - Within the loop, filter the observations to a particular continent (respective value of
region
variable). - Then, within the same loop, initialize a scatter plot of
'gdp per capita'
vs'life exp'
. Set color of points tocolor
and set thelabel
parameter toregion
. - Display the legend of the plot.
Obrigado pelo seu feedback!