Edit this page

< back to recipes

Parliament or hemicycle charts are used to visualise the number of seats held by each political party. The chart design is skeuomorphic because it resembles the layout of a parliament.

Ingredients

Data sources

Trafford Council

R packages

Parliament chart

Instructions

  1. Load the necessary R packages.
library(tidyverse) ; library(ggpol)
  1. Create a data frame with the different party names, the number of seats and their associated colours.
df <- tibble(
  party = factor(c("Green", "Liberal Democrats", "Conservative", "Labour"),
                 levels = c("Green", "Liberal Democrats", "Conservative", "Labour")),
  seats = c(3, 4, 20, 36),
  colours = c("#6AB023", "#FAA61A", "#0087DC", "#D32D41"))
  1. Plot the parliament chart.
ggplot(df) + 
  geom_parliament(aes(seats = seats, fill = party), colour = "#FFFFFF") + 
  scale_fill_manual(values = df$colours, labels = df$party,
                    guide = guide_legend(reverse = TRUE)) +
  labs(title = "Trafford Council Local Elections 2019",
       subtitle = "Council Seats",
       fill = NULL) +
  coord_fixed() + 
  theme_void() +
  theme(plot.title = element_text(size = 12, face = "bold", hjust = 0.5),
        plot.subtitle = element_text(hjust = 0.5),
        legend.position = "bottom")
  1. Output the chart as a PNG file.
ggsave("parliament_chart.png", dpi = 300)


Notes

The colour for each party can be found using an online tool like HTML Color Codes which matches the colour in an image to their HEX code.