• Steven Ponce
  • About
  • Data Visualizations
  • Projects
  • Resume
  • Email

On this page

  • Steps to Create this Graphic
    • 1. Load Packages & Setup
    • 2. Read in the Data
    • 3. Examine the Data
    • 4. Tidy Data
    • 5. Visualization Parameters
    • 6. Plot
    • 7. Save
    • 8. Session Info
    • 9. GitHub Repository
    • 10. References
    • 11. Custom Functions Documentation

Renewables Became the Cheapest Source of Electricity

  • Show All Code
  • Hide All Code

  • View Source

Global levelized cost of energy (LCOE), 2010–2024 · Solar and wind costs fell below fossil fuels, marking a structural shift in energy economics · 2024 USD/kWh

30DayChartChallenge
Data Visualization
R Programming
2026
Solar PV costs fell 90% between 2010 and 2024, dropping from $0.42/kWh to $0.043/kWh — well below the fossil fuel benchmark. This line chart traces the levelized cost of electricity (LCOE) for solar, onshore wind, offshore wind, and fossil fuels over 15 years, marking the crossover years when renewables became cost-competitive. Built with ggplot2 and IRENA data.
Author

Steven Ponce

Published

April 19, 2026

Figure 1: Line chart showing the levelized cost of electricity (LCOE) for four power sources from 2010 to 2024 in 2024 USD per kilowatt-hour. Solar PV begins at $0.42/kWh in 2010 and falls 90% to $0.043/kWh by 2024, the steepest decline of any technology. Onshore wind drops 69% from $0.11 to $0.034/kWh. Offshore wind declines from $0.19 to $0.079/kWh. Fossil fuels remain relatively flat near $0.09/kWh throughout, spiking to $0.14/kWh in 2022 before retreating. Two vertical dotted lines mark cost-parity crossover points: onshore wind becomes cost-competitive with fossil fuels in 2013, solar in 2017. By 2024, both solar and onshore wind generate electricity more cheaply than any fossil fuel alternative. Data source: IRENA Renewable Power Generation Costs reports.

Steps to Create this Graphic

1. Load Packages & Setup

Show code
```{r}
#| label: load
#| warning: false
#| message: false      
#| results: "hide"     

## 1. LOAD PACKAGES & SETUP ----
suppressPackageStartupMessages({
pacman::p_load(
  tidyverse, ggtext, showtext, patchwork,
  janitor, scales, glue, ggrepel
  )
})

### |- figure size ----
camcorder::gg_record(
  dir    = here::here("temp_plots"),
  device = "png",
  width  = 10,
  height = 8,
  units  = "in",
  dpi    = 320
)

# Source utility functions
suppressMessages(source(here::here("R/utils/fonts.R")))
source(here::here("R/utils/social_icons.R"))
source(here::here("R/utils/image_utils.R"))
source(here::here("R/themes/base_theme.R"))
```

2. Read in the Data

Show code
```{r}
#| label: read
#| include: true
#| eval: true
#| warning: false

### |- LCOE data (USD/kWh, 2024 USD) ----
# Source: IRENA Renewable Power Generation Costs reports 2010–2024
# All values are global weighted-average LCOE for newly-commissioned utility-scale plants
# Fossil fuel = weighted-average cost of new fossil fuel-fired capacity

lcoe_raw <- tribble(
  ~year, ~technology,       ~lcoe,
  # Solar PV
  2010,  "Solar PV",        0.417,
  2011,  "Solar PV",        0.360,
  2012,  "Solar PV",        0.280,
  2013,  "Solar PV",        0.200,
  2014,  "Solar PV",        0.165,
  2015,  "Solar PV",        0.122,
  2016,  "Solar PV",        0.100,
  2017,  "Solar PV",        0.086,
  2018,  "Solar PV",        0.068,
  2019,  "Solar PV",        0.057,
  2020,  "Solar PV",        0.057,
  2021,  "Solar PV",        0.048,
  2022,  "Solar PV",        0.049,
  2023,  "Solar PV",        0.044,
  2024,  "Solar PV",        0.043,
  # Onshore Wind
  2010,  "Onshore Wind",    0.111,
  2011,  "Onshore Wind",    0.104,
  2012,  "Onshore Wind",    0.097,
  2013,  "Onshore Wind",    0.090,
  2014,  "Onshore Wind",    0.083,
  2015,  "Onshore Wind",    0.076,
  2016,  "Onshore Wind",    0.066,
  2017,  "Onshore Wind",    0.060,
  2018,  "Onshore Wind",    0.056,
  2019,  "Onshore Wind",    0.053,
  2020,  "Onshore Wind",    0.039,
  2021,  "Onshore Wind",    0.033,
  2022,  "Onshore Wind",    0.033,
  2023,  "Onshore Wind",    0.033,
  2024,  "Onshore Wind",    0.034,
  # Offshore Wind
  2010,  "Offshore Wind",   0.188,
  2011,  "Offshore Wind",   0.198,
  2012,  "Offshore Wind",   0.193,
  2013,  "Offshore Wind",   0.185,
  2014,  "Offshore Wind",   0.178,
  2015,  "Offshore Wind",   0.170,
  2016,  "Offshore Wind",   0.152,
  2017,  "Offshore Wind",   0.140,
  2018,  "Offshore Wind",   0.127,
  2019,  "Offshore Wind",   0.115,
  2020,  "Offshore Wind",   0.084,
  2021,  "Offshore Wind",   0.075,
  2022,  "Offshore Wind",   0.081,
  2023,  "Offshore Wind",   0.076,
  2024,  "Offshore Wind",   0.079,
  # Fossil Fuel benchmark (weighted-average new capacity)
  2010,  "Fossil Fuels",    0.090,
  2011,  "Fossil Fuels",    0.090,
  2012,  "Fossil Fuels",    0.092,
  2013,  "Fossil Fuels",    0.093,
  2014,  "Fossil Fuels",    0.094,
  2015,  "Fossil Fuels",    0.093,
  2016,  "Fossil Fuels",    0.085,
  2017,  "Fossil Fuels",    0.086,
  2018,  "Fossil Fuels",    0.085,
  2019,  "Fossil Fuels",    0.084,
  2020,  "Fossil Fuels",    0.082,
  2021,  "Fossil Fuels",    0.094,
  2022,  "Fossil Fuels",    0.142,
  2023,  "Fossil Fuels",    0.100,
  2024,  "Fossil Fuels",    0.073
)
```

3. Examine the Data

Show code
```{r}
#| label: examine
#| include: true
#| eval: true
#| results: 'hide'
#| warning: false

glimpse(lcoe_raw)
```

4. Tidy Data

Show code
```{r}
#| label: tidy
#| warning: false

### |- factor levels and label data ----
tech_order <- c("Solar PV", "Onshore Wind", "Offshore Wind", "Fossil Fuels")

lcoe <- lcoe_raw |>
  mutate(
    technology = factor(technology, levels = tech_order),
    lcoe_cents = lcoe * 100 # convert to cents/kWh for more readable axis
  )

### |- endpoint labels (2024 values) ----
labels_2024 <- lcoe |>
  filter(year == 2024) |>
  mutate(
    label = glue("{technology}\n${round(lcoe, 3)}/kWh")
  )

### |- compute % decline for annotation ----
solar_2010 <- lcoe |>
  filter(technology == "Solar PV", year == 2010) |>
  pull(lcoe)
solar_2024 <- lcoe |>
  filter(technology == "Solar PV", year == 2024) |>
  pull(lcoe)
solar_pct_decline <- round((1 - solar_2024 / solar_2010) * 100, 0)

wind_2010 <- lcoe |>
  filter(technology == "Onshore Wind", year == 2010) |>
  pull(lcoe)
wind_2024 <- lcoe |>
  filter(technology == "Onshore Wind", year == 2024) |> 
  pull(lcoe)
wind_pct_decline <- round((1 - wind_2024 / wind_2010) * 100, 0)

### |- parity crossover: first year solar <= fossil ----
# Used to place the "cost parity" annotation
solar_parity_yr <- lcoe |>
  filter(technology %in% c("Solar PV", "Fossil Fuels")) |>
  select(year, technology, lcoe) |>
  pivot_wider(names_from = technology, values_from = lcoe) |>
  filter(`Solar PV` <= `Fossil Fuels`) |>
  slice_min(year) |>
  pull(year)

wind_parity_yr <- lcoe |>
  filter(technology %in% c("Onshore Wind", "Fossil Fuels")) |>
  select(year, technology, lcoe) |>
  pivot_wider(names_from = technology, values_from = lcoe) |>
  filter(`Onshore Wind` <= `Fossil Fuels`) |>
  slice_min(year) |>
  pull(year)
```

5. Visualization Parameters

Show code
```{r}
#| label: params
#| include: true
#| warning: false

### |- plot aesthetics ----
colors <- get_theme_colors(
  palette = list(
    solar    = "#F4A261",   
    onshore  = "#2A9D8F",   
    offshore = "#457B9D",  
    fossil   = "#6B6B6B",   
    bg       = "#FAFAF8",  
    parity   = "#E63946"
  )
)

### |- titles and caption ----
title_text    <- "Renewables Became the Cheapest Source of Electricity"
subtitle_text <- "Global levelized cost of energy (LCOE), 2010–2024 · Solar and wind costs fell below<br>
fossil fuels, marking a structural shift in energy economics · 2024 USD/kWh"

caption_text <- create_dcc_caption(
  dcc_year    = 2026,
  dcc_day     = 19,
  source_text = "IRENA · Renewable Power Generation Costs reports (2010–2024)"
)

### |- fonts ----
setup_fonts()
fonts <- get_font_families()

### |- technology colors vector ----
tech_colors <- c(
  "Solar PV"      = colors$palette$solar,
  "Onshore Wind"  = colors$palette$onshore,
  "Offshore Wind" = colors$palette$offshore,
  "Fossil Fuels"  = "#3D3D3D"    
)

tech_linewidth <- c(
  "Solar PV"      = 1.4,
  "Onshore Wind"  = 1.4,
  "Offshore Wind" = 1.0,
  "Fossil Fuels"  = 1.3          
)

tech_linetype <- c(
  "Solar PV"      = "solid",
  "Onshore Wind"  = "solid",
  "Offshore Wind" = "solid",
  "Fossil Fuels"  = "dashed"
)

### |- base theme ----
base_theme <- create_base_theme(colors)

weekly_theme <- extend_weekly_theme(
  base_theme,
  theme(
    # Background
    plot.background = element_rect(fill = colors$palette$bg, color = NA),
    panel.background = element_rect(fill = colors$palette$bg, color = NA),

    # Grid — horizontal only, very light
    panel.grid.major.y = element_line(color = "gray88", linewidth = 0.25),
    panel.grid.major.x = element_blank(),
    panel.grid.minor = element_blank(),

    # Axes
    axis.ticks = element_blank(),
    axis.text = element_text(family = fonts$text, size = 9, color = "gray40"),
    axis.title.x = element_blank(),
    axis.title.y = element_text(
      family = fonts$text, size = 9, color = "gray40",
      margin = margin(r = 8)
    ),

    # Title / subtitle / caption
    plot.title = element_text(
      family = fonts$title, face = "bold",
      size = 18, color = "gray10",
      margin = margin(b = 6)
    ),
    plot.subtitle = element_markdown(
      family = fonts$text, size = 10.5, color = "gray35",
      lineheight = 1.4, margin = margin(b = 20)
    ),
    plot.caption = element_markdown(
      family = fonts$text, size = 7.5, color = "gray55",
      hjust = 0, margin = margin(t = 16)
    ),
    plot.margin = margin(t = 20, r = 100, b = 16, l = 20)
  )
)

theme_set(weekly_theme)
```

6. Plot

Show code
```{r}
#| label: plot
#| warning: false

### |- main plot ----
p <- ggplot(
  data = lcoe,
  mapping = aes(
    x = year, y = lcoe, color = technology,
    linewidth = technology, linetype = technology
  )
) +

  # Geoms
  geom_vline(
    xintercept = solar_parity_yr,
    color = colors$palette$solar,
    linetype = "dotted",
    linewidth = 0.55,
    alpha = 0.7
  ) +
  geom_vline(
    xintercept = wind_parity_yr,
    color = colors$palette$onshore,
    linetype = "dotted",
    linewidth = 0.55,
    alpha = 0.7
  ) +
  geom_line(lineend = "round") +
  geom_point(
    data = labels_2024,
    size = 3,
    shape = 21,
    fill = colors$palette$bg,
    stroke = 1.4
  ) +

  # Annotate
  annotate(
    "text",
    x = 2010.2,
    y = lcoe |> filter(technology == "Solar PV", year == 2010) |> pull(lcoe),
    label = "Solar PV",
    hjust = 0,
    vjust = -0.5,
    size = 3,
    family = fonts$text,
    color = colors$palette$solar,
    fontface = "bold"
  ) +
  annotate(
    "text",
    x = 2010.2,
    y = lcoe |> filter(technology == "Offshore Wind", year == 2010) |> pull(lcoe),
    label = "Offshore Wind",
    hjust = 0,
    vjust = 1.6,
    size = 3,
    family = fonts$text,
    color = colors$palette$offshore,
    fontface = "bold"
  ) +
  annotate(
    "text",
    x = 2010.2,
    y = lcoe |> filter(technology == "Onshore Wind", year == 2010) |> pull(lcoe),
    label = "Onshore Wind",
    hjust = 0,
    vjust = -0.5,
    size = 3,
    family = fonts$text,
    color = colors$palette$onshore,
    fontface = "bold"
  ) +
  annotate(
    "text",
    x = 2010.2,
    y = lcoe |> filter(technology == "Fossil Fuels", year == 2010) |> pull(lcoe),
    label = "Fossil Fuels",
    hjust = 0,
    vjust = 1.6,
    size = 3,
    family = fonts$text,
    color = colors$palette$fossil,
    fontface = "bold"
  ) +
  annotate(
    "richtext",
    x = 2021,
    y = 0.43,
    label = glue(
      "<span style='font-size:15pt; color:{colors$palette$solar}'>**\u221290%**</span><br>",
      "<span style='font-size:8pt; color:gray35'>Solar cost decline since 2010</span>"
    ),
    hjust = 0,
    vjust = 1,
    size = 3,
    family = fonts$text,
    fill = NA,
    label.color = NA
  ) +
  annotate(
    "text",
    x = wind_parity_yr + 0.2,
    y = 0.35,
    label = glue("{wind_parity_yr}: Wind becomes\ncost-competitive"),
    hjust = 0,
    vjust = 1,
    size = 2.8,
    family = fonts$text,
    color = colors$palette$onshore,
    lineheight = 1.25
  ) +
  annotate(
    "text",
    x = solar_parity_yr + 0.2,
    y = 0.35,
    label = glue("{solar_parity_yr}: Solar becomes\ncost-competitive"),
    hjust = 0,
    vjust = 1,
    size = 2.8,
    family = fonts$text,
    color = colors$palette$solar,
    lineheight = 1.25
  ) +
  annotate("segment",
    x = 2024, xend = 2024.55,
    y = labels_2024 |> filter(technology == "Offshore Wind") |> pull(lcoe),
    yend = 0.185,
    color = colors$palette$offshore, linewidth = 0.35, alpha = 0.6
  ) +
  annotate("segment",
    x = 2024, xend = 2024.55,
    y = labels_2024 |> filter(technology == "Fossil Fuels") |> pull(lcoe),
    yend = 0.145,
    color = colors$palette$fossil, linewidth = 0.35, linetype = "dashed", alpha = 0.6
  ) +
  annotate("segment",
    x = 2024, xend = 2024.55,
    y = labels_2024 |> filter(technology == "Solar PV") |> pull(lcoe),
    yend = 0.105,
    color = colors$palette$solar, linewidth = 0.35, alpha = 0.6
  ) +
  annotate("segment",
    x = 2024, xend = 2024.55,
    y = labels_2024 |> filter(technology == "Onshore Wind") |> pull(lcoe),
    yend = 0.060,
    color = colors$palette$onshore, linewidth = 0.35, alpha = 0.6
  ) +
  annotate("text",
    x = 2024.6, y = 0.185,
    label = "Offshore Wind",
    hjust = 0, vjust = 0.5, size = 2.9,
    family = fonts$text, color = colors$palette$offshore,
    fontface = "bold"
  ) +
  annotate("text",
    x = 2024.6, y = 0.145,
    label = "Fossil Fuels",
    hjust = 0, vjust = 0.5, size = 2.9,
    family = fonts$text, color = colors$palette$fossil,
    fontface = "bold"
  ) +
  annotate("richtext",
    x = 2024.6, y = 0.105,
    label = glue(
      "<span style='color:{colors$palette$solar}'>**Solar PV**</span>  ",
      "<span style='color:{colors$palette$solar}'>\u2212{solar_pct_decline}%</span>"
    ),
    hjust = 0, vjust = 0.5, size = 2.9,
    family = fonts$text, fill = NA, label.color = NA, color = "gray35"
  ) +
  annotate("richtext",
    x = 2024.6, y = 0.060,
    label = glue(
      "<span style='color:{colors$palette$onshore}'>**Onshore Wind**</span>  ",
      "<span style='color:{colors$palette$onshore}'>\u2212{wind_pct_decline}%</span>"
    ),
    hjust = 0, vjust = 0.5, size = 2.9,
    family = fonts$text, fill = NA, label.color = NA, color = "gray35"
  ) +

  # Scales
  scale_color_manual(values = tech_colors) +
  scale_linewidth_manual(values = tech_linewidth) +
  scale_linetype_manual(values = tech_linetype) +
  scale_x_continuous(
    breaks = seq(2010, 2024, 2),
    expand = expansion(mult = c(0.02, 0.04))
  ) +
  scale_y_continuous(
    labels = label_dollar(suffix = "/kWh", accuracy = 0.01),
    breaks = seq(0, 0.40, 0.05),
    limits = c(0, 0.45),
    expand = expansion(mult = c(0, 0.02))
  ) +
  coord_cartesian(clip = "off") +

  # Labs
  labs(
    title = title_text,
    subtitle = subtitle_text,
    caption = caption_text,
    y = "LCOE (USD/kWh, 2024 real)"
  ) +
  guides(
    color = "none",
    linewidth = "none",
    linetype = "none"
  )
```

7. Save

Show code
```{r}
#| label: save
#| warning: false

### |-  plot image ----  
save_plot(
  p, 
  type = "30daychartchallenge", 
  year = 2026, 
  day = 19, 
  width = 10, 
  height = 8
  )
```

8. Session Info

TipExpand for Session Info
R version 4.5.3 (2026-03-11 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26100)

Matrix products: default
  LAPACK version 3.12.1

locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] here_1.0.2      ggrepel_0.9.8   glue_1.8.0      scales_1.4.0   
 [5] janitor_2.2.1   patchwork_1.3.2 showtext_0.9-8  showtextdb_3.0 
 [9] sysfonts_0.8.9  ggtext_0.1.2    lubridate_1.9.5 forcats_1.0.1  
[13] stringr_1.6.0   dplyr_1.2.1     purrr_1.2.2     readr_2.2.0    
[17] tidyr_1.3.2     tibble_3.3.1    ggplot2_4.0.2   tidyverse_2.0.0

loaded via a namespace (and not attached):
 [1] gtable_0.3.6       xfun_0.57          htmlwidgets_1.6.4  tzdb_0.5.0        
 [5] vctrs_0.7.3        tools_4.5.3        generics_0.1.4     curl_7.0.0        
 [9] gifski_1.32.0-2    pacman_0.5.1       pkgconfig_2.0.3    RColorBrewer_1.1-3
[13] S7_0.2.1           lifecycle_1.0.5    compiler_4.5.3     farver_2.1.2      
[17] textshaping_1.0.5  codetools_0.2-20   snakecase_0.11.1   litedown_0.9      
[21] htmltools_0.5.9    yaml_2.3.12        pillar_1.11.1      camcorder_0.1.0   
[25] magick_2.9.1       commonmark_2.0.0   tidyselect_1.2.1   digest_0.6.39     
[29] stringi_1.8.7      rsvg_2.7.0         rprojroot_2.1.1    fastmap_1.2.0     
[33] grid_4.5.3         cli_3.6.6          magrittr_2.0.5     withr_3.0.2       
[37] timechange_0.4.0   rmarkdown_2.31     otel_0.2.0         ragg_1.5.2        
[41] hms_1.1.4          evaluate_1.0.5     knitr_1.51         markdown_2.0      
[45] rlang_1.2.0        gridtext_0.1.6     Rcpp_1.1.1         xml2_1.5.2        
[49] svglite_2.2.2      rstudioapi_0.18.0  jsonlite_2.0.0     R6_2.6.1          
[53] systemfonts_1.3.2 

9. GitHub Repository

TipExpand for GitHub Repo

The complete code for this analysis is available in 30dcc_2026_19.qmd.

For the full repository, click here.

10. References

TipExpand for References
  1. Data Sources:
    • International Renewable Energy Agency (IRENA). Renewable Power Generation Costs annual reports (2010–2024). https://www.irena.org/Energy-Transition/Technology/Power-generation-costs
      • Data: global weighted-average LCOE by technology, hardcoded from published report tables
      • All values in 2024 USD/kWh | License: CC BY 4.0

11. Custom Functions Documentation

Note📦 Custom Helper Functions

This analysis uses custom functions from my personal module library for efficiency and consistency across projects.

Functions Used:

  • fonts.R: setup_fonts(), get_font_families() - Font management with showtext
  • social_icons.R: create_social_caption() - Generates formatted social media captions
  • image_utils.R: save_plot() - Consistent plot saving with naming conventions
  • base_theme.R: create_base_theme(), extend_weekly_theme(), get_theme_colors() - Custom ggplot2 themes

Why custom functions?
These utilities standardize theming, fonts, and output across all my data visualizations. The core analysis (data tidying and visualization logic) uses only standard tidyverse packages.

Source Code:
View all custom functions → GitHub: R/utils

Back to top

Citation

BibTeX citation:
@online{ponce2026,
  author = {Ponce, Steven},
  title = {Renewables {Became} the {Cheapest} {Source} of {Electricity}},
  date = {2026-04-19},
  url = {https://stevenponce.netlify.app/data_visualizations/30DayChartChallenge/2026/30dcc_2026_19.html},
  langid = {en}
}
For attribution, please cite this work as:
Ponce, Steven. 2026. “Renewables Became the Cheapest Source of Electricity.” April 19, 2026. https://stevenponce.netlify.app/data_visualizations/30DayChartChallenge/2026/30dcc_2026_19.html.
Source Code
---
title: "Renewables Became the Cheapest Source of Electricity"
subtitle: "Global levelized cost of energy (LCOE), 2010–2024 · Solar and wind costs fell below fossil fuels, marking a structural shift in energy economics · 2024 USD/kWh"
description: "Solar PV costs fell 90% between 2010 and 2024, dropping from $0.42/kWh to $0.043/kWh — well below the fossil fuel benchmark. This line chart traces the levelized cost of electricity (LCOE) for solar, onshore wind, offshore wind, and fossil fuels over 15 years, marking the crossover years when renewables became cost-competitive. Built with ggplot2 and IRENA data."
date: "2026-04-19" 
author:
  - name: "Steven Ponce"
    url: "https://stevenponce.netlify.app"
citation:
  url: "https://stevenponce.netlify.app/data_visualizations/30DayChartChallenge/2026/30dcc_2026_19.html"
categories: ["30DayChartChallenge", "Data Visualization", "R Programming", "2026"]
tags: [
  "30DayChartChallenge",
  "Timeseries",
  "Evolution",
  "Line Chart",
  "Energy Economics",
  "Renewable Energy",
  "LCOE",
  "Solar PV",
  "Wind Energy",
  "Fossil Fuels",
  "IRENA",
  "Energy Transition",
  "ggplot2"
]
image: "thumbnails/30dcc_2026_19.png"
format:
  html:
    toc: true
    toc-depth: 5
    code-link: true
    code-fold: true
    code-tools: true
    code-summary: "Show code"
    self-contained: true
    theme: 
      light: [flatly, assets/styling/custom_styles.scss]
      dark: [darkly, assets/styling/custom_styles_dark.scss]
editor_options: 
  chunk_output_type: inline
execute: 
  freeze: true                                                  
  cache: true                                                   
  error: false
  message: false
  warning: false
  eval: true
---

![Line chart showing the levelized cost of electricity (LCOE) for four power sources from 2010 to 2024 in 2024 USD per kilowatt-hour. Solar PV begins at $0.42/kWh in 2010 and falls 90% to $0.043/kWh by 2024, the steepest decline of any technology. Onshore wind drops 69% from $0.11 to $0.034/kWh. Offshore wind declines from $0.19 to $0.079/kWh. Fossil fuels remain relatively flat near $0.09/kWh throughout, spiking to $0.14/kWh in 2022 before retreating. Two vertical dotted lines mark cost-parity crossover points: onshore wind becomes cost-competitive with fossil fuels in 2013, solar in 2017. By 2024, both solar and onshore wind generate electricity more cheaply than any fossil fuel alternative. Data source: IRENA Renewable Power Generation Costs reports.](30dcc_2026_19.png){#fig-1}

### [**Steps to Create this Graphic**]{.mark}

#### [1. Load Packages & Setup]{.smallcaps}

```{r}
#| label: load
#| warning: false
#| message: false      
#| results: "hide"     

## 1. LOAD PACKAGES & SETUP ----
suppressPackageStartupMessages({
pacman::p_load(
  tidyverse, ggtext, showtext, patchwork,
  janitor, scales, glue, ggrepel
  )
})

### |- figure size ----
camcorder::gg_record(
  dir    = here::here("temp_plots"),
  device = "png",
  width  = 10,
  height = 8,
  units  = "in",
  dpi    = 320
)

# Source utility functions
suppressMessages(source(here::here("R/utils/fonts.R")))
source(here::here("R/utils/social_icons.R"))
source(here::here("R/utils/image_utils.R"))
source(here::here("R/themes/base_theme.R"))
```

#### [2. Read in the Data]{.smallcaps}

```{r}
#| label: read
#| include: true
#| eval: true
#| warning: false

### |- LCOE data (USD/kWh, 2024 USD) ----
# Source: IRENA Renewable Power Generation Costs reports 2010–2024
# All values are global weighted-average LCOE for newly-commissioned utility-scale plants
# Fossil fuel = weighted-average cost of new fossil fuel-fired capacity

lcoe_raw <- tribble(
  ~year, ~technology,       ~lcoe,
  # Solar PV
  2010,  "Solar PV",        0.417,
  2011,  "Solar PV",        0.360,
  2012,  "Solar PV",        0.280,
  2013,  "Solar PV",        0.200,
  2014,  "Solar PV",        0.165,
  2015,  "Solar PV",        0.122,
  2016,  "Solar PV",        0.100,
  2017,  "Solar PV",        0.086,
  2018,  "Solar PV",        0.068,
  2019,  "Solar PV",        0.057,
  2020,  "Solar PV",        0.057,
  2021,  "Solar PV",        0.048,
  2022,  "Solar PV",        0.049,
  2023,  "Solar PV",        0.044,
  2024,  "Solar PV",        0.043,
  # Onshore Wind
  2010,  "Onshore Wind",    0.111,
  2011,  "Onshore Wind",    0.104,
  2012,  "Onshore Wind",    0.097,
  2013,  "Onshore Wind",    0.090,
  2014,  "Onshore Wind",    0.083,
  2015,  "Onshore Wind",    0.076,
  2016,  "Onshore Wind",    0.066,
  2017,  "Onshore Wind",    0.060,
  2018,  "Onshore Wind",    0.056,
  2019,  "Onshore Wind",    0.053,
  2020,  "Onshore Wind",    0.039,
  2021,  "Onshore Wind",    0.033,
  2022,  "Onshore Wind",    0.033,
  2023,  "Onshore Wind",    0.033,
  2024,  "Onshore Wind",    0.034,
  # Offshore Wind
  2010,  "Offshore Wind",   0.188,
  2011,  "Offshore Wind",   0.198,
  2012,  "Offshore Wind",   0.193,
  2013,  "Offshore Wind",   0.185,
  2014,  "Offshore Wind",   0.178,
  2015,  "Offshore Wind",   0.170,
  2016,  "Offshore Wind",   0.152,
  2017,  "Offshore Wind",   0.140,
  2018,  "Offshore Wind",   0.127,
  2019,  "Offshore Wind",   0.115,
  2020,  "Offshore Wind",   0.084,
  2021,  "Offshore Wind",   0.075,
  2022,  "Offshore Wind",   0.081,
  2023,  "Offshore Wind",   0.076,
  2024,  "Offshore Wind",   0.079,
  # Fossil Fuel benchmark (weighted-average new capacity)
  2010,  "Fossil Fuels",    0.090,
  2011,  "Fossil Fuels",    0.090,
  2012,  "Fossil Fuels",    0.092,
  2013,  "Fossil Fuels",    0.093,
  2014,  "Fossil Fuels",    0.094,
  2015,  "Fossil Fuels",    0.093,
  2016,  "Fossil Fuels",    0.085,
  2017,  "Fossil Fuels",    0.086,
  2018,  "Fossil Fuels",    0.085,
  2019,  "Fossil Fuels",    0.084,
  2020,  "Fossil Fuels",    0.082,
  2021,  "Fossil Fuels",    0.094,
  2022,  "Fossil Fuels",    0.142,
  2023,  "Fossil Fuels",    0.100,
  2024,  "Fossil Fuels",    0.073
)

```

#### [3. Examine the Data]{.smallcaps}

```{r}
#| label: examine
#| include: true
#| eval: true
#| results: 'hide'
#| warning: false

glimpse(lcoe_raw)
```

#### [4. Tidy Data]{.smallcaps}

```{r}
#| label: tidy
#| warning: false

### |- factor levels and label data ----
tech_order <- c("Solar PV", "Onshore Wind", "Offshore Wind", "Fossil Fuels")

lcoe <- lcoe_raw |>
  mutate(
    technology = factor(technology, levels = tech_order),
    lcoe_cents = lcoe * 100 # convert to cents/kWh for more readable axis
  )

### |- endpoint labels (2024 values) ----
labels_2024 <- lcoe |>
  filter(year == 2024) |>
  mutate(
    label = glue("{technology}\n${round(lcoe, 3)}/kWh")
  )

### |- compute % decline for annotation ----
solar_2010 <- lcoe |>
  filter(technology == "Solar PV", year == 2010) |>
  pull(lcoe)
solar_2024 <- lcoe |>
  filter(technology == "Solar PV", year == 2024) |>
  pull(lcoe)
solar_pct_decline <- round((1 - solar_2024 / solar_2010) * 100, 0)

wind_2010 <- lcoe |>
  filter(technology == "Onshore Wind", year == 2010) |>
  pull(lcoe)
wind_2024 <- lcoe |>
  filter(technology == "Onshore Wind", year == 2024) |> 
  pull(lcoe)
wind_pct_decline <- round((1 - wind_2024 / wind_2010) * 100, 0)

### |- parity crossover: first year solar <= fossil ----
# Used to place the "cost parity" annotation
solar_parity_yr <- lcoe |>
  filter(technology %in% c("Solar PV", "Fossil Fuels")) |>
  select(year, technology, lcoe) |>
  pivot_wider(names_from = technology, values_from = lcoe) |>
  filter(`Solar PV` <= `Fossil Fuels`) |>
  slice_min(year) |>
  pull(year)

wind_parity_yr <- lcoe |>
  filter(technology %in% c("Onshore Wind", "Fossil Fuels")) |>
  select(year, technology, lcoe) |>
  pivot_wider(names_from = technology, values_from = lcoe) |>
  filter(`Onshore Wind` <= `Fossil Fuels`) |>
  slice_min(year) |>
  pull(year)

```


#### [5. Visualization Parameters]{.smallcaps}

```{r}
#| label: params
#| include: true
#| warning: false

### |- plot aesthetics ----
colors <- get_theme_colors(
  palette = list(
    solar    = "#F4A261",   
    onshore  = "#2A9D8F",   
    offshore = "#457B9D",  
    fossil   = "#6B6B6B",   
    bg       = "#FAFAF8",  
    parity   = "#E63946"
  )
)

### |- titles and caption ----
title_text    <- "Renewables Became the Cheapest Source of Electricity"
subtitle_text <- "Global levelized cost of energy (LCOE), 2010–2024 · Solar and wind costs fell below<br>
fossil fuels, marking a structural shift in energy economics · 2024 USD/kWh"

caption_text <- create_dcc_caption(
  dcc_year    = 2026,
  dcc_day     = 19,
  source_text = "IRENA · Renewable Power Generation Costs reports (2010–2024)"
)

### |- fonts ----
setup_fonts()
fonts <- get_font_families()

### |- technology colors vector ----
tech_colors <- c(
  "Solar PV"      = colors$palette$solar,
  "Onshore Wind"  = colors$palette$onshore,
  "Offshore Wind" = colors$palette$offshore,
  "Fossil Fuels"  = "#3D3D3D"    
)

tech_linewidth <- c(
  "Solar PV"      = 1.4,
  "Onshore Wind"  = 1.4,
  "Offshore Wind" = 1.0,
  "Fossil Fuels"  = 1.3          
)

tech_linetype <- c(
  "Solar PV"      = "solid",
  "Onshore Wind"  = "solid",
  "Offshore Wind" = "solid",
  "Fossil Fuels"  = "dashed"
)

### |- base theme ----
base_theme <- create_base_theme(colors)

weekly_theme <- extend_weekly_theme(
  base_theme,
  theme(
    # Background
    plot.background = element_rect(fill = colors$palette$bg, color = NA),
    panel.background = element_rect(fill = colors$palette$bg, color = NA),

    # Grid — horizontal only, very light
    panel.grid.major.y = element_line(color = "gray88", linewidth = 0.25),
    panel.grid.major.x = element_blank(),
    panel.grid.minor = element_blank(),

    # Axes
    axis.ticks = element_blank(),
    axis.text = element_text(family = fonts$text, size = 9, color = "gray40"),
    axis.title.x = element_blank(),
    axis.title.y = element_text(
      family = fonts$text, size = 9, color = "gray40",
      margin = margin(r = 8)
    ),

    # Title / subtitle / caption
    plot.title = element_text(
      family = fonts$title, face = "bold",
      size = 18, color = "gray10",
      margin = margin(b = 6)
    ),
    plot.subtitle = element_markdown(
      family = fonts$text, size = 10.5, color = "gray35",
      lineheight = 1.4, margin = margin(b = 20)
    ),
    plot.caption = element_markdown(
      family = fonts$text, size = 7.5, color = "gray55",
      hjust = 0, margin = margin(t = 16)
    ),
    plot.margin = margin(t = 20, r = 100, b = 16, l = 20)
  )
)

theme_set(weekly_theme)
```

#### [6. Plot]{.smallcaps}

```{r}
#| label: plot
#| warning: false

### |- main plot ----
p <- ggplot(
  data = lcoe,
  mapping = aes(
    x = year, y = lcoe, color = technology,
    linewidth = technology, linetype = technology
  )
) +

  # Geoms
  geom_vline(
    xintercept = solar_parity_yr,
    color = colors$palette$solar,
    linetype = "dotted",
    linewidth = 0.55,
    alpha = 0.7
  ) +
  geom_vline(
    xintercept = wind_parity_yr,
    color = colors$palette$onshore,
    linetype = "dotted",
    linewidth = 0.55,
    alpha = 0.7
  ) +
  geom_line(lineend = "round") +
  geom_point(
    data = labels_2024,
    size = 3,
    shape = 21,
    fill = colors$palette$bg,
    stroke = 1.4
  ) +

  # Annotate
  annotate(
    "text",
    x = 2010.2,
    y = lcoe |> filter(technology == "Solar PV", year == 2010) |> pull(lcoe),
    label = "Solar PV",
    hjust = 0,
    vjust = -0.5,
    size = 3,
    family = fonts$text,
    color = colors$palette$solar,
    fontface = "bold"
  ) +
  annotate(
    "text",
    x = 2010.2,
    y = lcoe |> filter(technology == "Offshore Wind", year == 2010) |> pull(lcoe),
    label = "Offshore Wind",
    hjust = 0,
    vjust = 1.6,
    size = 3,
    family = fonts$text,
    color = colors$palette$offshore,
    fontface = "bold"
  ) +
  annotate(
    "text",
    x = 2010.2,
    y = lcoe |> filter(technology == "Onshore Wind", year == 2010) |> pull(lcoe),
    label = "Onshore Wind",
    hjust = 0,
    vjust = -0.5,
    size = 3,
    family = fonts$text,
    color = colors$palette$onshore,
    fontface = "bold"
  ) +
  annotate(
    "text",
    x = 2010.2,
    y = lcoe |> filter(technology == "Fossil Fuels", year == 2010) |> pull(lcoe),
    label = "Fossil Fuels",
    hjust = 0,
    vjust = 1.6,
    size = 3,
    family = fonts$text,
    color = colors$palette$fossil,
    fontface = "bold"
  ) +
  annotate(
    "richtext",
    x = 2021,
    y = 0.43,
    label = glue(
      "<span style='font-size:15pt; color:{colors$palette$solar}'>**\u221290%**</span><br>",
      "<span style='font-size:8pt; color:gray35'>Solar cost decline since 2010</span>"
    ),
    hjust = 0,
    vjust = 1,
    size = 3,
    family = fonts$text,
    fill = NA,
    label.color = NA
  ) +
  annotate(
    "text",
    x = wind_parity_yr + 0.2,
    y = 0.35,
    label = glue("{wind_parity_yr}: Wind becomes\ncost-competitive"),
    hjust = 0,
    vjust = 1,
    size = 2.8,
    family = fonts$text,
    color = colors$palette$onshore,
    lineheight = 1.25
  ) +
  annotate(
    "text",
    x = solar_parity_yr + 0.2,
    y = 0.35,
    label = glue("{solar_parity_yr}: Solar becomes\ncost-competitive"),
    hjust = 0,
    vjust = 1,
    size = 2.8,
    family = fonts$text,
    color = colors$palette$solar,
    lineheight = 1.25
  ) +
  annotate("segment",
    x = 2024, xend = 2024.55,
    y = labels_2024 |> filter(technology == "Offshore Wind") |> pull(lcoe),
    yend = 0.185,
    color = colors$palette$offshore, linewidth = 0.35, alpha = 0.6
  ) +
  annotate("segment",
    x = 2024, xend = 2024.55,
    y = labels_2024 |> filter(technology == "Fossil Fuels") |> pull(lcoe),
    yend = 0.145,
    color = colors$palette$fossil, linewidth = 0.35, linetype = "dashed", alpha = 0.6
  ) +
  annotate("segment",
    x = 2024, xend = 2024.55,
    y = labels_2024 |> filter(technology == "Solar PV") |> pull(lcoe),
    yend = 0.105,
    color = colors$palette$solar, linewidth = 0.35, alpha = 0.6
  ) +
  annotate("segment",
    x = 2024, xend = 2024.55,
    y = labels_2024 |> filter(technology == "Onshore Wind") |> pull(lcoe),
    yend = 0.060,
    color = colors$palette$onshore, linewidth = 0.35, alpha = 0.6
  ) +
  annotate("text",
    x = 2024.6, y = 0.185,
    label = "Offshore Wind",
    hjust = 0, vjust = 0.5, size = 2.9,
    family = fonts$text, color = colors$palette$offshore,
    fontface = "bold"
  ) +
  annotate("text",
    x = 2024.6, y = 0.145,
    label = "Fossil Fuels",
    hjust = 0, vjust = 0.5, size = 2.9,
    family = fonts$text, color = colors$palette$fossil,
    fontface = "bold"
  ) +
  annotate("richtext",
    x = 2024.6, y = 0.105,
    label = glue(
      "<span style='color:{colors$palette$solar}'>**Solar PV**</span>  ",
      "<span style='color:{colors$palette$solar}'>\u2212{solar_pct_decline}%</span>"
    ),
    hjust = 0, vjust = 0.5, size = 2.9,
    family = fonts$text, fill = NA, label.color = NA, color = "gray35"
  ) +
  annotate("richtext",
    x = 2024.6, y = 0.060,
    label = glue(
      "<span style='color:{colors$palette$onshore}'>**Onshore Wind**</span>  ",
      "<span style='color:{colors$palette$onshore}'>\u2212{wind_pct_decline}%</span>"
    ),
    hjust = 0, vjust = 0.5, size = 2.9,
    family = fonts$text, fill = NA, label.color = NA, color = "gray35"
  ) +

  # Scales
  scale_color_manual(values = tech_colors) +
  scale_linewidth_manual(values = tech_linewidth) +
  scale_linetype_manual(values = tech_linetype) +
  scale_x_continuous(
    breaks = seq(2010, 2024, 2),
    expand = expansion(mult = c(0.02, 0.04))
  ) +
  scale_y_continuous(
    labels = label_dollar(suffix = "/kWh", accuracy = 0.01),
    breaks = seq(0, 0.40, 0.05),
    limits = c(0, 0.45),
    expand = expansion(mult = c(0, 0.02))
  ) +
  coord_cartesian(clip = "off") +

  # Labs
  labs(
    title = title_text,
    subtitle = subtitle_text,
    caption = caption_text,
    y = "LCOE (USD/kWh, 2024 real)"
  ) +
  guides(
    color = "none",
    linewidth = "none",
    linetype = "none"
  )
```

#### [7. Save]{.smallcaps}

```{r}
#| label: save
#| warning: false

### |-  plot image ----  
save_plot(
  p, 
  type = "30daychartchallenge", 
  year = 2026, 
  day = 19, 
  width = 10, 
  height = 8
  )
```

#### [8. Session Info]{.smallcaps}

::: {.callout-tip collapse="true"}
##### Expand for Session Info

```{r, echo = FALSE}
#| eval: true
#| warning: false

sessionInfo()
```
:::

#### [9. GitHub Repository]{.smallcaps} 

::: {.callout-tip collapse="true"}
##### Expand for GitHub Repo

The complete code for this analysis is available in [`30dcc_2026_19.qmd`](https://github.com/poncest/personal-website/blob/master/data_visualizations/TidyTuesday/2026/30dcc_2026_19.qmd).

For the full repository, [click here](https://github.com/poncest/personal-website/).
:::


#### [10. References]{.smallcaps}
::: {.callout-tip collapse="true"}
##### Expand for References
1. **Data Sources:**
   - International Renewable Energy Agency (IRENA).
     *Renewable Power Generation Costs* annual reports (2010–2024).
     https://www.irena.org/Energy-Transition/Technology/Power-generation-costs
     - Data: global weighted-average LCOE by technology, hardcoded from published report tables
     - All values in 2024 USD/kWh | License: CC BY 4.0
:::


#### [11. Custom Functions Documentation]{.smallcaps}

::: {.callout-note collapse="true"}
##### 📦 Custom Helper Functions

This analysis uses custom functions from my personal module library for efficiency and consistency across projects.

**Functions Used:**

-   **`fonts.R`**: `setup_fonts()`, `get_font_families()` - Font management with showtext
-   **`social_icons.R`**: `create_social_caption()` - Generates formatted social media captions
-   **`image_utils.R`**: `save_plot()` - Consistent plot saving with naming conventions
-   **`base_theme.R`**: `create_base_theme()`, `extend_weekly_theme()`, `get_theme_colors()` - Custom ggplot2 themes

**Why custom functions?**\
These utilities standardize theming, fonts, and output across all my data visualizations. The core analysis (data tidying and visualization logic) uses only standard tidyverse packages.

**Source Code:**\
View all custom functions → [GitHub: R/utils](https://github.com/poncest/personal-website/tree/master/R)
:::

© 2024 Steven Ponce

Source Issues