Visualizing population with x-axis on a log scale
In the last exercise you created a histogram of populations across countries. You might have noticed that there were several countries with a much higher population than others, which causes the distribution to be very skewed, with most of the distribution crammed into a small part of the graph. (Consider that it's hard to tell the median or the minimum population from that histogram).
To make the histogram more informative, you can try putting the x-axis on a log scale.
Questo esercizio fa parte del corso
Introduction to the Tidyverse
Istruzioni dell'esercizio
- Use the
gapminder_1952dataset (code is provided) to create a histogram of country population (pop) in the year 1952, putting the x-axis on a log scale withscale_x_log10().
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)
# Create a histogram of population (pop), with x on a log scale