Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Group by Region | Scatter Plots
Visualization in Python with matplotlib

Group by RegionGroup by Region

Tarea

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:

  1. Iterate over pair of colors and regions, using color and region as dummy variables.
  2. Within the loop, filter the observations to a particular continent (respective value of region variable).
  3. Then, within the same loop, initialize a scatter plot of 'gdp per capita' vs 'life exp'. Set color of points to color and set the label parameter to region.
  4. Display the legend of the plot.

¿Todo estuvo claro?

Sección 3. Capítulo 8
toggle bottom row
course content

Contenido del Curso

Visualization in Python with matplotlib

Group by RegionGroup by Region

Tarea

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:

  1. Iterate over pair of colors and regions, using color and region as dummy variables.
  2. Within the loop, filter the observations to a particular continent (respective value of region variable).
  3. Then, within the same loop, initialize a scatter plot of 'gdp per capita' vs 'life exp'. Set color of points to color and set the label parameter to region.
  4. Display the legend of the plot.

¿Todo estuvo claro?

Sección 3. Capítulo 8
toggle bottom row
some-alt