|
@@ -107,3 +107,19 @@ pvplot <- ggplot(filter(partylev, Party %in% names(partycolours)),
|
107
|
107
|
expand=c(0,0), limits = c(0, 0.5), labels = scales::percent) +
|
108
|
108
|
labs(title = "Party vote trajectories")
|
109
|
109
|
pvplot
|
|
110
|
+
|
|
111
|
+daily <- read.csv("2020-advance-vote-data.csv", stringsAsFactors = FALSE) %>%
|
|
112
|
+ filter(Date != "Totals") %>% mutate(Date = as.Date(Date)) %>%
|
|
113
|
+ pivot_longer(cols = X2020.General.Election:X2014.General.Election, names_to = "Year", names_pattern = "^X([0-9]{4}).*$", values_to = "Votes") %>%
|
|
114
|
+ mutate(Votes = ifelse(is.na(Votes), 0, Votes))
|
|
115
|
+
|
|
116
|
+dailyplot <- ggplot(daily, aes(x = Date, y = Votes, fill = Year)) +
|
|
117
|
+ geom_col(position="dodge") +
|
|
118
|
+ scale_x_date("2020 election-equivalent date",
|
|
119
|
+ date_breaks = "1 day", date_labels = "%a %b %e",
|
|
120
|
+ expand = c(0,0)) +
|
|
121
|
+ scale_fill_brewer("Election year", palette = "Set2") +
|
|
122
|
+ scale_y_continuous("Advance votes", labels = scales::comma, expand = c(0,0)) +
|
|
123
|
+ labs(title = "Daily Advance Votes", subtitle = "Last updated 8 October 2020") +
|
|
124
|
+ theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1))
|
|
125
|
+dailyplot
|