Created
April 19, 2017 20:43
-
-
Save mattm/17646e5e87e73bba9a56f22f3804d724 to your computer and use it in GitHub Desktop.
Stacked Area Chart - Tidyr Solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data <- read.csv("data.csv", sep = "\t") | |
data <- data %>% | |
tidyr::spread(key = plan, value = signups, fill = 0) %>% | |
tidyr::gather(key = plan, value = signups, - week) %>% | |
arrange(week, plan) | |
g <- ggplot(data, aes(x = week, y = signups, group = plan, fill = plan)) + | |
geom_area(position = "stack") | |
print(g) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment