Bump chart of Scottish greenhouse gas emissions
This article is originally published at https://scottishsnow.wordpress.com
The Ferret ran a piece today on Scotland’s greenhouse gas emissions. They did a great job of making their source data available, either through links or embedded into the their charts. I liked the first chart on the contributions of different sectors to the overall total, and thought it might work well as a bump chart.
I’ve used bump charts previously, for example in this analysis of voting patterns. One of the best things about coding is being able to reuse work. So it took 5 minutes to generate the plot below (code at the bottom).
If you’ve not seen a bump chart before, the category order is set by the magnitude at a given point on the x axis. So transport is currently the sector with the largest GHG emissions.

library(tidyverse)
library(ggalluvial)
df = read_csv("Downloads/ferret_data_ghg.csv") %>%
rename(year = `Row Labels`) %>%
pivot_longer(!year)
df %>%
ggplot(aes(x = year, y = value, alluvium = name)) +
geom_alluvium(aes(fill = name, colour = name),
alpha = .75, decreasing = FALSE) +
scale_colour_brewer(type = "qual", palette = "Paired") +
scale_fill_brewer(type = "qual", palette = "Paired") +
labs(title = "How do different economic sectors contribute\nto Scotland's Greenhouse Gas Emissions?",
subtitle = "Data from https://theferret.scot/cop26-scotlands-greenhouse-gas-emissions-explained/",
x = "Year",
y = "GHG emissions (MtCO2e)",
fill = "Sector",
colour = "Sector") +
theme_minimal() +
theme(text = element_text(size = 20),
plot.subtitle = element_text(size = 12))
Thanks for visiting r-craft.org
This article is originally published at https://scottishsnow.wordpress.com
Please visit source website for post related comments.