Last active
November 11, 2016 16:03
-
-
Save rudeboybert/b88cc53c419ad47eeaf4255617809c43 to your computer and use it in GitHub Desktop.
Voter Turnout for Dems vs Repubs in 2008, 2012, 2016
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
# Same plot as https://rudeboybert.github.io/MATH116/assets/figure/blue_vs_red.jpg | |
# But with y-axis starting at 0 | |
library(dplyr) | |
library(ggplot2) | |
voter_turnout <- data_frame( | |
# Make year a categorical variable: | |
Year = as.factor(c(2008, 2008, 2012, 2012, 2016, 2016)), | |
Party = c("Democrat", "Republican", "Democrat", "Republican", "Democrat", "Republican"), | |
Votes = c(69.5, 60, 66, 61, 59, 59) | |
) | |
ggplot(data=voter_turnout, aes(x=Year, y=Votes, fill=Party)) + | |
geom_bar(stat="identity", position="dodge") + | |
labs(x="Year", y="Votes (in millions)") + | |
scale_fill_manual(values=c("blue", "red")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment