Skip to content

Instantly share code, notes, and snippets.

@ramnathv
Last active December 30, 2015 10:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramnathv/6ce063236154691e8f30 to your computer and use it in GitHub Desktop.
Save ramnathv/6ce063236154691e8f30 to your computer and use it in GitHub Desktop.
NPR Viz Replication using ggplot2 and directlabels
pkgs <- list('dplyr', 'tidyr', 'ggplot2', 'readr', 'directlabels', 'ggthemes');
for (pkg in pkgs) library(pkg, character.only = T)
read_csv("http://apps.npr.org/dailygraphics/graphics/women-cs/data.csv") %>%
mutate_each(funs(as.numeric)) %>%
gather('school', 'value', 2:5) %>%
{ggplot(data = ., aes(x = date, y = value, color = school)) +
geom_line() +
theme_minimal() +
scale_x_continuous(expand = c(0.3, 5))
} %>%
direct.label('last.bumpup')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment