Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@benmarwick
Last active September 13, 2019 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benmarwick/cffb82fb6d9192354d495a2e0ded4e55 to your computer and use it in GitHub Desktop.
Save benmarwick/cffb82fb6d9192354d495a2e0ded4e55 to your computer and use it in GitHub Desktop.
Plot the population of Han Chinese in Taiwan from Wikipedia
library(tidyverse)
pop_han_in_tw <- tribble(
~year, ~population,
1684, 120000,
1764, 666210,
1782, 912920,
1811, 1944737,
1840, 2500000,
1902, 2686356,
1926, 4168000,
1944, 6269949,
1956, 9367661)
breaks <- plyr::round_any(seq(min(pop_han_in_tw$year), max(pop_han_in_tw$year), 50), 50)
ggplot(pop_han_in_tw,
aes(year, population)) +
geom_col() +
scale_y_log10(labels = scales::comma) +
scale_x_continuous(
labels = breaks,
breaks = breaks) +
labs(x = "Year",
y = "Population of Han Chinese in Taiwan",
caption ="data from Wikipedia") +
theme_bw()
@benmarwick
Copy link
Author

benmarwick commented Sep 13, 2019

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment