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.
The primary objectives of this analysis are:
library(tidyverse)
library(plotly)
library(viridis)
library(scales)
library(ggthemes)
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.
clean_data <- data %>%
filter(year >= 2000) %>%
filter(!is.na(country)) %>%
filter(iso_code != "") %>%
filter(!is.na(methane))
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)
The visualization highlights the countries contributing most significantly to global methane emissions. Large agricultural economies and industrialized nations dominate methane production.
countries <- c("India", "China", "Brazil", "United States", "Indonesia")
trend_data <- clean_data %>%
filter(country %in% countries)
ggplot(trend_data,
aes(x = year,
y = nitrous_oxide,
color = country)) +
geom_line(size = 1.2) +
labs(
title = "Nitrous Oxide Emission Trends (2000–2024)",
x = "Year",
y = "Nitrous Oxide Emissions",
caption = "Source: Our World in Data"
) +
theme_minimal(base_size = 13)
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once per session.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
The graph compares nitrous oxide emissions among major agricultural nations. Several developing economies demonstrate steadily increasing emissions over time.
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")
)
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.
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)
Most countries produce relatively low methane emissions, while a smaller number contribute disproportionately high amounts.
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)
Carbon dioxide remains the dominant greenhouse gas globally, although methane and nitrous oxide continue to contribute substantially to total 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)
Highly populated nations tend to demonstrate larger non-CO2 greenhouse gas emissions due to agricultural production, industrialization, and energy consumption.
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.
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
The interactive chart allows users to dynamically compare methane emissions among the world’s leading methane-producing nations.
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.