Comparing population and GDP per capita
In the video you learned to create a scatter plot with GDP per capita on the x-axis and life expectancy on the y-axis (the code for that graph has been provided in the exercise code). When you're exploring data visually, you'll often need to try different combinations of variables and aesthetics.
Questo esercizio fa parte del corso
Introduction to the Tidyverse
Istruzioni dell'esercizio
- Change the scatter plot of
gapminder_1952so that (pop) is on the x-axis and GDP per capita (gdpPercap) is on the y-axis.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
library(gapminder)
library(dplyr)
library(ggplot2)
gapminder_1952 <- gapminder %>%
filter(year == 1952)
# Change to put pop on the x-axis and gdpPercap on the y-axis
ggplot(gapminder_1952, aes(x = gdpPercap, y = lifeExp)) +
geom_point()