Introduction

Methane and nitrous oxide are among the most powerful greenhouse gases contributing to global climate change. Although carbon dioxide receives the most public attention, non-CO2 greenhouse gases significantly influence atmospheric warming, agriculture, industrial activity, and environmental sustainability.

This project explores global methane and nitrous oxide emissions between 2000 and 2024 using the Our World in Data (OWID) greenhouse gas emissions dataset.

Objectives

The primary objectives of this analysis are:

  • Identify the countries with the highest methane emissions
  • Analyze long-term nitrous oxide emission trends
  • Explore the relationship between economic growth and methane output
  • Compare greenhouse gas compositions over time
  • Examine regional and continental emission patterns

Load Required Libraries

library(tidyverse)
library(plotly)
library(viridis)
library(scales)
library(ggthemes)

Data Source

The dataset used in this project is sourced from:

https://github.com/owid/co2-data

Load Dataset

url <- "https://raw.githubusercontent.com/owid/co2-data/master/owid-co2-data.csv"

data <- read_csv(url)
## Rows: 50411 Columns: 79
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (2): country, iso_code
## dbl (77): year, population, gdp, cement_co2, cement_co2_per_capita, co2, co2...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

Data Cleaning

clean_data <- data %>%
  filter(year >= 2000) %>%
  filter(!is.na(country)) %>%
  filter(iso_code != "") %>%
  filter(!is.na(methane))

Visualization 1: Top 10 Methane Emitting Countries

latest_year <- max(clean_data$year, na.rm = TRUE)

top10_methane <- clean_data %>%
  filter(year == latest_year) %>%
  arrange(desc(methane)) %>%
  slice(1:10)

ggplot(top10_methane,
       aes(x = reorder(country, methane),
           y = methane,
           fill = methane)) +
  geom_col() +
  coord_flip() +
  scale_fill_viridis_c() +
  labs(
    title = "Top 10 Methane Emitting Countries",
    subtitle = paste("Year:", latest_year),
    x = "Country",
    y = "Methane Emissions",
    caption = "Source: Our World in Data"
  ) +
  theme_minimal(base_size = 13)

Interpretation

The visualization highlights the countries contributing most significantly to global methane emissions. Large agricultural economies and industrialized nations dominate methane production.


Visualization 3: Interactive GDP vs Methane Emissions

gdp_data <- clean_data %>%
  filter(year == 2022) %>%
  filter(
    !is.na(gdp),
    !is.na(methane),
    gdp > 0,
    methane > 0
  )

plot_ly(
  data = gdp_data,
  x = ~gdp / 1000000000000,
  y = ~methane,
  type = "scatter",
  mode = "markers",
  text = ~country,
  hovertemplate =
    paste(
      "<b>%{text}</b><br>",
      "GDP: %{x:.2f} Trillion USD<br>",
      "Methane Emissions: %{y:.2f}",
      "<extra></extra>"
    ),
  marker = list(
    size = 10,
    color = "darkgreen",
    opacity = 0.6
  )
) %>%
  layout(
    title = "Interactive GDP vs Methane Emissions (2022)",
    xaxis = list(title = "GDP (Trillion USD)"),
    yaxis = list(title = "Methane Emissions")
  )

Interpretation

The interactive chart demonstrates the relationship between economic growth and methane emissions. Countries with larger economies often exhibit higher methane outputs due to industrial and agricultural activities.


Visualization 4: Global Methane Emission Distribution

ggplot(clean_data %>%
         filter(year == latest_year),
       aes(x = methane)) +
  geom_histogram(fill = "skyblue",
                 color = "black",
                 bins = 30) +
  labs(
    title = "Distribution of Methane Emissions",
    subtitle = "Global Distribution Across Countries",
    x = "Methane Emissions",
    y = "Frequency",
    caption = "Source: Our World in Data"
  ) +
  theme_minimal(base_size = 13)

Interpretation

Most countries produce relatively low methane emissions, while a smaller number contribute disproportionately high amounts.


Visualization 5: Greenhouse Gas Composition Over Time

ghg_data <- clean_data %>%
  group_by(year) %>%
  summarise(
    co2 = sum(co2, na.rm = TRUE),
    methane = sum(methane, na.rm = TRUE),
    nitrous_oxide = sum(nitrous_oxide, na.rm = TRUE)
  )

ghg_long <- ghg_data %>%
  pivot_longer(cols = c(co2, methane, nitrous_oxide),
               names_to = "gas",
               values_to = "emissions")

ggplot(ghg_long,
       aes(x = year,
           y = emissions,
           fill = gas)) +
  geom_area(alpha = 0.8) +
  labs(
    title = "Global Greenhouse Gas Composition Over Time",
    x = "Year",
    y = "Emissions",
    fill = "Greenhouse Gas",
    caption = "Source: Our World in Data"
  ) +
  theme_minimal(base_size = 13)

Interpretation

Carbon dioxide remains the dominant greenhouse gas globally, although methane and nitrous oxide continue to contribute substantially to total emissions.


Visualization 6: Population vs Nitrous Oxide Emissions

bubble_data <- clean_data %>%
  filter(year == 2022) %>%
  filter(
    !is.na(population),
    !is.na(nitrous_oxide),
    population > 0,
    nitrous_oxide > 0
  )

ggplot(bubble_data,
       aes(x = population / 1000000,
           y = nitrous_oxide,
           size = methane)) +
  geom_point(alpha = 0.6,
             color = "purple") +
  labs(
    title = "Population vs Nitrous Oxide Emissions",
    subtitle = "Bubble Size Represents Methane Emissions",
    x = "Population (Millions)",
    y = "Nitrous Oxide Emissions",
    size = "Methane",
    caption = "Source: Our World in Data"
  ) +
  theme_minimal(base_size = 13)

Interpretation

Highly populated nations tend to demonstrate larger non-CO2 greenhouse gas emissions due to agricultural production, industrialization, and energy consumption.


Visualization 7: Methane Emissions Across Major Countries

country_data <- clean_data %>%
  filter(year == latest_year) %>%
  filter(country %in% c(
    "United States",
    "China",
    "India",
    "Brazil",
    "Russia",
    "Germany",
    "Indonesia"
  )) %>%
  filter(!is.na(methane))

ggplot(country_data,
       aes(x = reorder(country, methane),
           y = methane,
           fill = country)) +
  geom_col() +
  coord_flip() +
  labs(
    title = "Methane Emissions Across Major Countries",
    x = "Country",
    y = "Methane Emissions",
    caption = "Source: Our World in Data"
  ) +
  theme_minimal(base_size = 13)

### Interpretation

The box plot demonstrates substantial variation in methane emissions across continents, with some regions exhibiting significantly wider emission ranges than others.


Visualization 8: Interactive Top Methane Producers

plot_ly(
  data = top10_methane,
  x = ~country,
  y = ~methane,
  type = "bar",
  color = ~methane
) %>%
  layout(
    title = "Interactive Top 10 Methane Emitting Countries",
    xaxis = list(title = "Country"),
    yaxis = list(title = "Methane Emissions")
  )
## Warning: textfont.color doesn't (yet) support data arrays
## Warning: textfont.color doesn't (yet) support data arrays

Interpretation

The interactive chart allows users to dynamically compare methane emissions among the world’s leading methane-producing nations.


Conclusion

This project analyzed global methane and nitrous oxide emissions between 2000 and 2024 using the OWID greenhouse gas dataset.

Key findings include:

The analysis emphasizes the importance of addressing non-CO2 greenhouse gases alongside carbon dioxide in global climate policy and sustainability planning.

References