The UK has just held a Westminster election to decide the next government. There are some amazing visualisations of what’s happened to the whole nation, but I think there’s a story to tell about my local constituency.
I live in Midlothian, Scotland. It’s a former mining area and this was once the main employment. Miners were a heavily unionised workforce and I think knowing this helps understand the path of voting patterns.
I’ve been reading John Harris recently, and I think his approach to listen to differing views helps understand what is going on around us. With this in mind, I’ve annotated a plot of election results for Midlothian since 1955. I made the plot in R (code below), and annotated in LibreOffice Draw. The dominance of non-voters since 2001 really highlights how important it is to exercise our democratic right!
Here’s the R code I used for the bump chart:
library(tidyverse) library(lubridate) library(ggalluvial) votes %>% mutate(party = fct_expand(party, "Cons & Unionist"), party = fct_recode(party, `Cons & Unionist` = "Conservative"), party = fct_recode(party, `Cons & Unionist` = "Unionist"), party = fct_recode(party, Green = "Scottish Green"), party = fct_lump(f = party, n = 5), party = fct_relevel(party, "Didn't vote")) %>% group_by(id, date, party) %>% summarise(votes = sum(votes)) %>% left_join(x %>% select(id, pop)) %>% mutate(prop = votes / pop) %>% ggplot(aes(x = as.character(date), y = prop, alluvium = party)) + geom_alluvium(aes(fill = party, colour = party), alpha = .75, decreasing = FALSE) + scale_x_discrete(labels = str_sub(date, 1, 4)) + scale_y_continuous(labels = scales::percent) + scale_colour_manual(values = pal) + scale_fill_manual(values = pal) + labs(x = "Election", y = "Votes", fill = "Party", colour = "Party") + theme_minimal() + theme(text = element_text(size = 20))