Exercise: Create a Gapminder scatter plot using size

Create a scatter plot with ggplot2 which shows the relationship between GDP per capita and life expectancy for the year 2007 using the gapminder_2007 dataset.

  1. Use the ggplot() function and specify the gapminder_2007 dataset as input
  2. Add a geom_point() layer to the plot and create a scatter plot showing the GDP per capita gdpPercap on the x-axis and the life expectancy lifeExp on the y-axis
  3. Use the size aesthetic to adjust the point size by the population pop
  4. Use the scale_size_area() function so that the point sizes reflect actual population differences and set the max_size of each point to 10
Output

Submit code to see output here.

Specify additional aesthetics for points