title: “Emissions and Energy Use” output: flexdashboard::flex_dashboard: orientation: rows vertical_layout: fill —
top5 <- c("United States", "China", "India", "Russia", "Japan")
energy %>%
filter(country %in% top5, year >= 1980, !is.na(greenhouse_gas_emissions)) %>%
ggplot(aes(x = year, y = greenhouse_gas_emissions, color = country)) +
geom_line(size = 1.2) +
labs(
title = "GHG Emissions Over Time",
x = "Year",
y = "Greenhouse Gas Emissions"
) +
theme_minimal()
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
This line chart shows the total greenhouse gas emissions from 1980 to 2020 for five major countries.
China’s emissions have surged since the early 2000s, surpassing the U.S. to become the largest emitter.
The United States peaked around 2005 and has shown a slow decline since.
India is steadily rising as it industrializes and expands its energy needs.
Russia’s emissions fell dramatically in the early 1990s.
Japan has remained relatively stable with only slight fluctuations.
This chart gives a clear picture of long-term emissions growth and economic development.
top5 <- c("United States", "China", "India", "Russia", "Japan")
energy %>%
filter(country %in% top5, year >= 1980, !is.na(greenhouse_gas_emissions)) %>%
ggplot(aes(x = country, y = greenhouse_gas_emissions, fill = country)) +
geom_boxplot(alpha = 0.7) +
labs(
title = "Distribution of GHG Emissions (1980–2020)",
x = "Country",
y = "GHG Emissions (tons CO₂e)"
) +
theme_minimal()
This boxplot shows the distribution of greenhouse gas emissions from 1980 to 2020 for each of the top five countries.
China has a wide range, reflecting rapid growth and variability in its emissions over the past two decades.
The U.S. shows high and consistent emissions, with less variation across years.
India has lower emissions, but the box shows a clear upward shift over time.
Russia’s distribution shows a sharp drop in emissions in the early 1990s.
Japan shows a narrower and more stable range, with less fluctuation.
This visualization makes it easy to compare not just the average emissions of each country, but also their volatility and change over time.
energy %>%
filter(country %in% top5, year >= 1980, !is.na(energy_per_capita)) %>%
ggplot(aes(x = year, y = energy_per_capita, color = country)) +
geom_line(size = 1.2) +
labs(
title = "Energy Use per Capita Over Time (1980–2020)",
x = "Year",
y = "Energy Use per Capita (kWh/person)"
) +
theme_minimal()
This line chart shows how the average amount of energy used per person has changed from 1980 to 2020 in five major countries.
The United States and Russia have consistently had the highest energy use per person, reflecting more energy intensive lifestyles and industries.
China and India have shown sharp increases in recent decades as their economies grew and access to energy expanded.
Japan has remained relatively stable, which may reflect energy efficiency and efforts.
The chart helps us understand how development, population growth, and economic activity affect energy consumption patterns over time.
# Make sure per capita variable exists
energy <- energy %>%
mutate(ghg_per_capita = greenhouse_gas_emissions / population)
energy %>%
filter(country %in% top5, year >= 1980, !is.na(ghg_per_capita)) %>%
ggplot(aes(x = year, y = ghg_per_capita)) +
geom_line(color = "steelblue", size = 1.2) +
facet_wrap(~ country, scales = "free_y") +
labs(
title = "GHG Emissions Per Capita Over Time",
x = "Year",
y = "GHG Emissions per Person (tons CO₂e)"
) +
theme_minimal()
Each chart shows the greenhouse gas emissions per person over time for a specific country.
The U.S. has the highest per-capita emissions and has stayed mostly stable.
China’s per-person emissions increased sharply in the 2000s.
India shows a slow and steady rise from a very low base.
Russia and Japan have fluctuated slightly but remain well above global average levels.
These country-specific charts highlight how emissions patterns differ even when total emissions may look similar.