The Carbon Majors Emissions Data provides a comprehensive database of historical emissions from some of the world’s largest producers of oil, gas, coal, and cement. This dataset, compiled by Carbon Majors and acknowledged by Data is Plural, includes data from as far back as 1854. It covers 122 entities, which comprise 75 investor-owned companies, 36 state-owned companies, and 11 nation states. Among these are 82 oil producers, 81 gas producers, 49 coal producers, and 6 cement producers. The data is used to quantify both direct operational emissions and emissions from the combustion of marketed products attributable to these entities. This extensive dataset captures over 1.42 trillion tonnes of CO2, representing 72% of global fossil fuel and cement emissions since the Industrial Revolution began in 1751. The available data is categorized with medium granularity, detailing information by year, entity, entity type, commodity, commodity production, commodity unit, and total emissions.
The analysis of the Carbon Majors Emissions Data reveals significant trends in the sources of CO2 emissions over time. Historically, coal has been the predominant source of CO2 emissions, maintaining this status for much of human history. However, starting in the late 1970s, the share of emissions from oil, natural gas liquids (NGL), and natural gas began to rise significantly. This shift indicates a diversification in energy sources and their corresponding emissions. Interestingly, since the early 2000s, there has been a notable resurgence in coal emissions, driven primarily by increased demand for bituminous coal in Asia. In contrast, sub-bituminous and lignite coals, which are of lower quality, have largely been phased out, highlighting a shift towards higher-grade coal in the global energy market.
How I made this graphic?
Loading required libraries, data import & creating custom functions
Code
# Data Import and Wrangling Toolslibrary(tidyverse) # All things tidy# Final plot toolslibrary(scales) # Nice Scales for ggplot2library(fontawesome) # Icons display in ggplot2library(ggtext) # Markdown text support for ggplot2library(showtext) # Display fonts in ggplot2library(colorspace) # Lighten and Darken colourslibrary(patchwork) # Combining plotslibrary(gganimate) # For animation# Load dataemissions <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2024/2024-05-21/emissions.csv')
Exploratory Data Analysis & Data Wrangling
Code
# Number of entitites per year - as a graphemissions |>count(year) |>ggplot(aes(x = year, y = n)) +geom_point() +geom_line()# Emissions total per yearemissions |>group_by(year) |>summarise(total_emissions =sum(total_emissions_MtCO2e)) |>ggplot(aes(x = year, y = total_emissions)) +geom_point() +geom_line()emissions |>count(commodity) |>pull(commodity)coal_levels <-c("Sub-Bituminous Coal","Lignite Coal","Bituminous Coal","Anthracite Coal","Thermal Coal","Metallurgical Coal","Oil & NGL","Natural Gas","Cement")df <- emissions |>group_by(year, commodity) |>summarise(total_emissions =sum(total_emissions_MtCO2e)) |>ungroup() |>group_by(year) |>mutate(perc = total_emissions/sum(total_emissions),comm_2 =if_else(str_detect(commodity, "Coal"),"Coal", commodity ),commodity =fct(commodity, levels = coal_levels) ) |>ungroup() |>group_by(year) |>mutate(yearly_total =sum(total_emissions))yearly_df <- df |>group_by(year) |>summarise(yearly_total =round(sum(total_emissions), 1))# Checking if each year exists in the datasetdf |>distinct(year) |>mutate(x =row_number()) |>ggplot(aes(x, year)) +geom_col(width =1)df |>ggplot(aes(x = year,y = total_emissions,fill = commodity ) ) +geom_col(position =position_fill()) +scale_fill_brewer(palette ="Dark2")df |>ggplot(aes(x = year,y = total_emissions,fill = comm_2 ) ) +geom_col(position =position_fill())# Percentage of 2022's emissions in that yeardf2 <- emissions |>mutate(commodity =fct(commodity, levels = coal_levels)) |>group_by(year, commodity) |>summarise(total_emissions_co2 =sum(total_emissions_MtCO2e)) |>ungroup() |>group_by(year) |>mutate(year_total =sum(total_emissions_co2) ) |>ungroup() |>mutate(overall_perc =round(100* year_total /max(year_total), 2) )
Visualization Parameters
Code
# Font for titlesfont_add_google("Handlee",family ="title_font") # Font for the captionfont_add_google("Saira Extra Condensed",family ="caption_font") # Font for plot textfont_add_google("Saira Condensed",family ="body_font") showtext_auto()bg_col <-"white"# Credits for coffeee palettemypal <-c("#F7CB45FF","#EE8026FF","#DC050CFF","#E8601CFF","#A5170EFF","#E65518FF", "#B4E2FFFF","#7ED7D1FF","#7BAFDEFF")text_col <-"#00007FFF"text_hil <-"#00009BFF"# Caption stuff for the plotsysfonts::font_add(family ="Font Awesome 6 Brands",regular = here::here("docs", "Font Awesome 6 Brands-Regular-400.otf"))github <-""github_username <-"aditya-dahiya"xtwitter <-""xtwitter_username <-"@adityadahiyaias"social_caption_1 <- glue::glue("<span style='font-family:\"Font Awesome 6 Brands\";'>{github};</span> <span style='color: {text_hil}'>{github_username} </span>")social_caption_2 <- glue::glue("<span style='font-family:\"Font Awesome 6 Brands\";'>{xtwitter};</span> <span style='color: {text_hil}'>{xtwitter_username}</span>")
Annotation Text for the Plot
Code
plot_title <-"Coal's Legacy, Oil's Rise"plot_caption <-paste0("Data: CarbonMajors | Code: @aditya-dahiya (GitHub)" )plot_subtitle <-str_wrap("Shift in contributors to global Cabon dioxide Emissions Sources over Time", 100)str_view(plot_subtitle)