Climate change and sustainable energy are among the most important global issues today. This report explores trends in renewable energy adoption and carbon emissions across countries over time. The goal of this project is to analyze renewable energy growth, compare countries, and examine the relationship between renewable energy usage and carbon dioxide emissions.
Primary Dataset: - Our World in Data Energy Dataset - https://github.com/owid/energy-data
Secondary Dataset: - World Bank Open Data - https://data.worldbank.org/
``` r
energy <- read_csv("owid-energy-data.csv")
## Rows: 23377 Columns: 130
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): country, iso_code
## dbl (128): year, population, gdp, biofuel_cons_change_pct, biofuel_cons_chan...
##
## ℹ 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.
latest_year <- max(energy$year, na.rm = TRUE)
selected_countries <- c(
"United States",
"India",
"China",
"Germany"
)
glimpse(energy)
## Rows: 23,377
## Columns: 130
## $ country <chr> "ASEAN (Ember)", "ASEAN (…
## $ year <dbl> 2000, 2001, 2002, 2003, 2…
## $ iso_code <chr> NA, NA, NA, NA, NA, NA, N…
## $ population <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gdp <dbl> NA, NA, NA, NA, NA, NA, N…
## $ biofuel_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ biofuel_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ biofuel_cons_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ biofuel_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ biofuel_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ biofuel_electricity <dbl> 5.87, 6.46, 6.62, 7.44, 8…
## $ biofuel_share_elec <dbl> 1.550, 1.595, 1.528, 1.62…
## $ biofuel_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ carbon_intensity_elec <dbl> 572.58, 570.27, 572.68, 5…
## $ coal_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_cons_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_electricity <dbl> 76.03, 86.26, 93.43, 102.…
## $ coal_prod_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_prod_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_prod_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_production <dbl> NA, NA, NA, NA, NA, NA, N…
## $ coal_share_elec <dbl> 20.073, 21.294, 21.568, 2…
## $ coal_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ electricity_demand <dbl> 378.76, 405.09, 433.19, 4…
## $ electricity_demand_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ electricity_generation <dbl> 378.76, 405.09, 433.19, 4…
## $ electricity_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ energy_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ energy_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ energy_per_gdp <dbl> NA, NA, NA, NA, NA, NA, N…
## $ fossil_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ fossil_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ fossil_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ fossil_electricity <dbl> 305.53, 327.90, 356.66, 3…
## $ fossil_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ fossil_fuel_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ fossil_share_elec <dbl> 80.666, 80.945, 82.333, 8…
## $ fossil_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_electricity <dbl> 164.26, 190.41, 208.92, 2…
## $ gas_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_prod_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_prod_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_prod_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_production <dbl> NA, NA, NA, NA, NA, NA, N…
## $ gas_share_elec <dbl> 43.368, 47.004, 48.228, 4…
## $ gas_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ greenhouse_gas_emissions <dbl> 216.87, 231.01, 248.08, 2…
## $ hydro_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ hydro_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ hydro_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ hydro_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ hydro_electricity <dbl> 50.43, 54.33, 53.30, 53.2…
## $ hydro_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ hydro_share_elec <dbl> 13.314, 13.412, 12.304, 1…
## $ hydro_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ low_carbon_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ low_carbon_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ low_carbon_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ low_carbon_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ low_carbon_electricity <dbl> 73.23, 77.19, 76.53, 76.3…
## $ low_carbon_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ low_carbon_share_elec <dbl> 19.334, 19.055, 17.667, 1…
## $ low_carbon_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ net_elec_imports <dbl> NA, NA, NA, NA, NA, NA, N…
## $ net_elec_imports_share_demand <dbl> NA, NA, NA, NA, NA, NA, N…
## $ nuclear_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ nuclear_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ nuclear_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ nuclear_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ nuclear_electricity <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ nuclear_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ nuclear_share_elec <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ nuclear_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_electricity <dbl> 65.24, 51.23, 54.31, 53.3…
## $ oil_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_prod_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_prod_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_prod_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_production <dbl> NA, NA, NA, NA, NA, NA, N…
## $ oil_share_elec <dbl> 17.225, 12.647, 12.537, 1…
## $ oil_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ other_renewable_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ other_renewable_electricity <dbl> 22.80, 22.86, 23.23, 23.1…
## $ other_renewable_exc_biofuel_electricity <dbl> 16.93, 16.40, 16.61, 15.7…
## $ other_renewables_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ other_renewables_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ other_renewables_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ other_renewables_elec_per_capita_exc_biofuel <dbl> NA, NA, NA, NA, NA, NA, N…
## $ other_renewables_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ other_renewables_share_elec <dbl> 6.020, 5.643, 5.363, 5.05…
## $ other_renewables_share_elec_exc_biofuel <dbl> 4.470, 4.048, 3.834, 3.43…
## $ other_renewables_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ per_capita_electricity <dbl> NA, NA, NA, NA, NA, NA, N…
## $ primary_energy_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ renewables_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ renewables_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ renewables_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ renewables_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ renewables_electricity <dbl> 73.23, 77.19, 76.53, 76.3…
## $ renewables_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ renewables_share_elec <dbl> 19.334, 19.055, 17.667, 1…
## $ renewables_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ solar_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ solar_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ solar_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ solar_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ solar_electricity <dbl> 0.00, 0.00, 0.00, 0.00, 0…
## $ solar_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ solar_share_elec <dbl> 0.000, 0.000, 0.000, 0.00…
## $ solar_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
## $ wind_cons_change_pct <dbl> NA, NA, NA, NA, NA, NA, N…
## $ wind_cons_change_twh <dbl> NA, NA, NA, NA, NA, NA, N…
## $ wind_consumption <dbl> NA, NA, NA, NA, NA, NA, N…
## $ wind_elec_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ wind_electricity <dbl> 0.00, 0.00, 0.00, 0.00, 0…
## $ wind_energy_per_capita <dbl> NA, NA, NA, NA, NA, NA, N…
## $ wind_share_elec <dbl> 0.000, 0.000, 0.000, 0.00…
## $ wind_share_energy <dbl> NA, NA, NA, NA, NA, NA, N…
This figure displays carbon dioxide emissions trends across major countries.
fig2_data <- energy %>%
filter(country %in% c("United States", "India", "China", "Germany"),
year >= 2000) %>%
select(country, year, carbon_intensity_elec) %>%
filter(!is.na(carbon_intensity_elec))
ggplot(fig2_data,
aes(x = year,
y = carbon_intensity_elec,
color = country,
group = country)) +
geom_line(size = 1.2) +
labs(
title = "Carbon Intensity of Electricity Over Time",
x = "Year",
y = "Carbon Intensity",
color = "Country"
) +
theme_light()
This bar chart compares renewable electricity generation among countries.
fig3_data <- energy %>%
filter(year == 2020) %>%
select(country, renewables_electricity) %>%
drop_na() %>%
arrange(desc(renewables_electricity)) %>%
slice_head(n = 10)
ggplot(fig3_data,
aes(x = reorder(country, renewables_electricity),
y = renewables_electricity,
fill = country)) +
geom_col() +
coord_flip() +
labs(
title = "Top Countries by Renewable Electricity Generation",
x = "Country",
y = "Renewable Electricity"
) +
theme_minimal() +
theme(legend.position = "none")
This scatter plot examines the relationship between renewable energy share and carbon emissions.
fig4_data <- energy %>%
filter(year == 2020) %>%
select(country, renewables_share_energy, carbon_intensity_elec) %>%
filter(!is.na(renewables_share_energy), !is.na(carbon_intensity_elec))
ggplot(fig4_data,
aes(x = renewables_share_energy,
y = carbon_intensity_elec)) +
geom_point(alpha = 0.7, color = "steelblue") +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(
title = "Renewable Energy Share vs Carbon Intensity",
x = "Renewable Energy Share (%)",
y = "Carbon Intensity of Electricity"
) +
theme_classic()
## `geom_smooth()` using formula = 'y ~ x'
This area chart visualizes changes in renewable and fossil fuel energy production over time.
fig6_data <- energy %>%
filter(country == "World",
year >= 2000) %>%
select(year,
coal_production,
oil_production,
gas_production,
renewables_consumption)
fig6_long <- fig6_data %>%
pivot_longer(-year,
names_to = "energy_type",
values_to = "value")
ggplot(fig6_long,
aes(x = year,
y = value,
fill = energy_type)) +
geom_area(alpha = 0.8) +
labs(
title = "Global Energy Mix Over Time",
x = "Year",
y = "Energy Production/Consumption",
fill = "Energy Type"
) +
theme_minimal()
## Warning: Removed 4 rows containing non-finite outside the scale range
## (`stat_align()`).
This interactive figure allows users to explore renewable energy share and emissions across countries.
fig8_year <- energy %>%
filter(
!is.na(iso_code),
!str_starts(iso_code, "OWID"),
!is.na(solar_share_energy),
!is.na(wind_share_energy)
) %>%
summarise(max_year = max(year, na.rm = TRUE)) %>%
pull(max_year)
fig8_data <- energy %>%
filter(
year == fig8_year,
!is.na(iso_code),
!str_starts(iso_code, "OWID")
) %>%
select(country, solar_share_energy, wind_share_energy, renewables_share_energy, population) %>%
drop_na()
p <- ggplot(
fig8_data,
aes(
x = solar_share_energy,
y = wind_share_energy,
size = population,
color = renewables_share_energy,
text = country
)
) +
geom_point(alpha = 0.75) +
scale_color_viridis_c() +
labs(
title = paste("Interactive Solar vs Wind Share in", fig8_year),
x = "Solar Share of Energy (%)",
y = "Wind Share of Energy (%)",
color = "Renewable Share",
size = "Population"
) +
theme_minimal()
ggplotly(p, tooltip = c("text", "x", "y"))
This report explored renewable energy adoption and carbon emissions across countries using multiple forms of data visualization. The visualizations demonstrated that renewable energy usage has generally increased over time, although trends differ significantly between countries.
The analysis also showed that countries with higher renewable energy adoption may experience lower carbon emissions, though the relationship varies depending on economic and industrial factors. Interactive and comparative visualizations helped reveal global patterns and provide deeper insights into sustainability trends.
Overall, the project demonstrates how data visualization can be used to communicate complex environmental and energy-related issues clearly and effectively.