Skip to content

Instantly share code, notes, and snippets.

@ramnathv ramnathv/README.md

Last active Dec 30, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.