Skip to content

Voter Turnout in German Federal Elections

Thomas Lin Pedersen edited this page Sep 4, 2018 · 2 revisions

submitted by Felix Golcher

on the suggestion of Sonja Ernst

library(tidyverse)
library(gganimate)

The Data

The data represent voter turnout in German federal elections from 2002 to 2017 ("Heft 4, Wahlbeteiligung und Stimmabgabe der Frauen und Männer nach Altersgruppen", page 11, linked from here).

turnout <- tibble(year = c(2002, 2002, 2002, 2002, 2002, 2002, 2002, 
                           2002, 2002, 2002, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 
                           2005, 2005, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 
                           2009, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 
                           2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017), 
                  group = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
                                      1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 
                                      5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 
                                      9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L), 
                                    .Label = c("18-20", "21-24", "25-29", "30-34", "35-39", 
                                               "40-44", "45-49", "50-59", "60-69", "> 69"), 
                                    class = "factor"), 
                  percent = c(69.9, 67.7, 71.6, 76.2, 79.2, 
                              79.6, 80.6, 83.4, 85.7, 77.7, 69.6, 66, 69.5, 73.9, 77.9, 
                              79.2, 79.7, 81.8, 84.2, 75.8, 62.5, 58.6, 60.6, 64.5, 68.5, 
                              71.9, 72.6, 74.1, 79.2, 72, 63.7, 59.6, 61.6, 64.8, 68.1, 
                              71.8, 74, 74.7, 78.7, 73.7, 69.9, 67, 68.6, 72, 74.4, 76.3, 
                              78.8, 79.4, 81, 75.8))

The Code

wanim <- ggplot(turnout, aes(group, percent)) +
  geom_bar(stat = "identity") +
  geom_line(aes(x = as.numeric(factor(group)), col = factor(year)), size = 1) +
  scale_colour_discrete("year") +
  theme_minimal() +
  scale_x_discrete("age group") +
  transition_time(year) +
  labs(title="{if(frame_time <= 2017) round(frame_time) else 2017}") +
  shadow_mark(exclude_layer = 1)

animate(wanim, nframes = 150, fps = 10, width = 600, height = 600,
        renderer = gifski_renderer(loop = F)))

Voter Turnout in German Federal Elections (2002-2017)

Why this way? How to do better?

The final stage of the animation contains all information, so why an animation? It helps to immediately get the fact, that voter turnout goes sharply down in 2009 and rises equally sharply in 2017, without having to decode the colors first. To retain all passed stages as colored lines, on the other hand, helps to interpret the resulting image carefully after the animation finished.

I would have preferred a visualization highlighting the unequal width of the age bins, but couldn't come up with a solution achieving this while still being readable in all other respects.

In the present state, the animation stops at the end. An immediate loop does not allow to have a careful look at the endpoint of the development. A longer pause at the end of the animation would be the best solution, but I don't know how to achieve this.

Discussion

I think the animation highlights the following points:

  • The overall distribution stays the same, although its height varies greatly from election to election. The probability for someone casting her vote seems to be determined by her age but varies quite a bit from election to election. Each of those two factors acts (nearly) independently from each other.
  • related: There is astonishingly little noise in the data.
  • The little kink at 35-39 in the 2002/2005 elections is shifted upwards a bit while people get older. The highest age bins are too wide to give information on detailed age development here.
  • There is no general time trend in the data. Turnout drops between 2005 and 2009 but goes up nearly to the starting level with the 2017 elections.
  • The turnout of young people gains a little bit when compared to older people. This is contrary to a commonly held belief, that the young are disenchanted with politics (politikverdrossen). At least the last 15 years do not support this claim.