• 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

Cheap coffee isn’t necessarily affordable coffee

  • Show All Code
  • Hide All Code

  • View Source

The Cappuccino Index measures the minutes a barista must work to afford a small cappuccino. Across these countries, barista wages vary far more than cappuccino prices.

TidyTuesday
Data Visualization
R Programming
2026
An annotated scatter plot comparing mean hourly barista wages to mean cappuccino prices across 87 countries, using the Cappuccino Index (minutes of work per cappuccino) with iso-affordability contour lines at 30/60/120 minutes. Pakistan and India show cheap coffee but extreme work-time costs due to low wages, while Switzerland and Denmark show expensive coffee but low work-time costs due to high wages. Built in R with ggplot2, geomtextpath, and ggrepel.
Author

Steven Ponce

Published

September 7, 2026

Figure 1: Scatter plot titled “Cheap coffee isn’t necessarily affordable coffee,” plotting mean hourly barista wage against mean cappuccino price across 87 countries on log-log axes, with dashed diagonal lines marking equal work-time cost at 30, 60, and 120 minutes. Pakistan (£1.87 cappuccino, 277 minutes of work) and India (£1.96, 172 minutes) sit far left with cheap coffee but extreme work-time burdens driven by very low wages. Switzerland and Denmark, both averaging £5.41 per cappuccino, require only 14 and 19 minutes, respectively, reflecting high wages. The remaining gray points cluster loosely along the diagonal. Source: James Hoffmann via Filip Reierson.

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({
if (!require("pacman")) install.packages("pacman")
pacman::p_load(
    tidyverse, ggtext, showtext, janitor, ggrepel,      
    scales, glue, skimr, ggview, geomtextpath
    )
})

# 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

## 2. READ IN THE DATA ----
tt <- tidytuesdayR::tt_load(2026, week = 36)
cafe <- tt$cafe
cappuccino_index <- tt$cappuccino_index
rm(tt)
```

3. Examine the Data

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

## 3. EXAMINING THE DATA ----
glimpse(cafe)
skim_without_charts(cafe)
glimpse(cappuccino_index)
skim_without_charts(cappuccino_index)
```

4. Tidy Data

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

# Country-level means — 
driver_diag <- cafe |>
    group_by(country) |>
    summarise(
        n = n(),
        mean_price = mean(price_gbp),
        mean_wage  = mean(hourly_wage_gbp),
        .groups = "drop"
    ) |>
    left_join(
        cappuccino_index |> select(country, published_index = index),
        by = "country"
    )

# Primary contrast -
primary_countries <- c("India", "Pakistan", "Switzerland", "Denmark")

# Winning contour set from cheap-render testing: 30 / 60 / 120 -
iso_lines <- tibble(
    index_level = c(30, 60, 120),
    intercept   = log(index_level / 60),
    contour_label = paste0(index_level, " min")
)
```

5. Visualization Parameters

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

### |- plot aesthetics ----
colors <- get_theme_colors(
    palette = c(highlight = "#722F37", secondary = "gray70")
)

### |- titles and caption ----
title_text <- str_glue("Cheap coffee isn't necessarily affordable coffee")

subtitle_line1 <- "The **Cappuccino Index** measures the minutes a barista must work to afford a small cappuccino." |>
    str_wrap(width = 100) |>
    str_replace_all("\n", "<br>")

subtitle_line2 <- "Across these countries, barista wages vary far more than cappuccino prices." |>
    str_wrap(width = 90) |>
    str_replace_all("\n", "<br>")

subtitle_text <- str_glue("{subtitle_line1}<br>{subtitle_line2}")

caption_source <- "James Hoffmann via Filip Reierson. Index = 60 x mean price / mean wage per country. Cross-country dispersion (log scale): barista wages vary 2.5x more than cappuccino prices." |>
    str_wrap(width = 100) |>
    str_replace_all("\n", "<br>")

caption_text <- create_social_caption(
    tt_year = 2026,
    tt_week = 36,
    source_text = caption_source
)

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

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

weekly_theme <- extend_weekly_theme(
  base_theme,
  theme(
    plot.title = element_textbox_simple(
      size = 20,
      face = "bold",
      family = fonts$title_1,
      color = colors$title,
      lineheight = 1.1,
      margin = margin(b = 8)
    ),
    plot.subtitle = element_textbox_simple(
      size = 12.5,
      family = fonts$subtitle,
      color = colors$subtitle,
      margin = margin(b = 20)
    ),
    plot.caption = element_textbox_simple(
      size = 6.0,
      family = fonts$caption,
      color = colors$caption,
      margin = margin(t = 12)
    ),
    panel.grid.minor = element_blank(),
    panel.grid.major = element_line(color = "gray92", linewidth = 0.25)
  )
)

theme_set(weekly_theme)
```

6. Plot

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

### |- plot ----
p <- driver_diag |>
    ggplot(aes(x = mean_wage, y = mean_price)) +
    geom_textabline(
        data = iso_lines,
        aes(slope = 1, intercept = intercept, label = contour_label),
        color = "gray55", linetype = "dashed", linewidth = 0.35,
        size = 2.8, hjust = 0.88, text_smoothing = 0
    ) +
    geom_point(alpha = 0.45, color = "gray55", size = 1.8) +
    geom_point(
        data = driver_diag |> filter(country %in% primary_countries),
        color = "#722F37", size = 3
    ) +
    geom_text_repel(
        data = driver_diag |> filter(country %in% primary_countries),
        aes(label = country),
        size = 3.4, fontface = "plain", color = "#2C2825",
        min.segment.length = 0, seed = 1234,
        box.padding = 0.5, point.padding = 0.3, force = 2, max.overlaps = Inf
    ) +
    annotate(
        "richtext",
        x = 0.6, y = 1.5,
        label = "**Cheap, but not affordable**<br>India \u00b7 £1.96 \u2192 172 min<br>Pakistan \u00b7 £1.87 \u2192 277 min",
        hjust = 0, size = 3.1, color = "#2C2825",
        fill = NA, label.color = NA
    ) +
    annotate(
        "richtext",
        x = 7, y = 4.3,
        label = "**Expensive, but relatively affordable**<br>Switzerland \u00b7 £5.41 \u2192 14 min<br>Denmark \u00b7 £5.41 \u2192 19 min",
        hjust = 0, size = 3.1, color = "#2C2825",
        fill = NA, label.color = NA
    ) +
    scale_x_log10(labels = scales::label_currency(prefix = "£")) +
    scale_y_log10(labels = scales::label_currency(prefix = "£")) +
    labs(
        title = title_text,
        subtitle = subtitle_text,
        caption = caption_text,
        x = "Mean hourly wage (log scale)",
        y = "Mean cappuccino price (log scale)"
    )
```

7. Save

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

### |- save ----
main_path  <- here::here("data_visualizations", "TidyTuesday", "2026", "tt_2026_36.png")
thumb_path <- here::here("data_visualizations", "TidyTuesday", "2026", "thumbnails", "tt_2026_36.png")

# Full-size version, for the QMD figure
save_ggplot(
  plot = p,
  file = main_path,
  width = 10,
  height = 7.5,
  units = "in",
  dpi = 300,
  create.dir = TRUE
)

# Reduced-size thumbnail, for the YAML `image:` field
fs::dir_create(dirname(thumb_path))
magick::image_read(main_path) |>
  magick::image_resize("400") |>
  magick::image_write(thumb_path)
```

8. Session Info

TipExpand for Session Info
R version 4.6.1 (2026-06-24)
Platform: aarch64-apple-darwin23
Running under: macOS Tahoe 26.6.2

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.1

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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         geomtextpath_0.2.0 ggview_0.2.2       skimr_2.2.2       
 [5] glue_1.8.1         scales_1.4.0       ggrepel_0.9.8      janitor_2.2.1     
 [9] showtext_0.9-8     showtextdb_3.0     sysfonts_0.8.9     ggtext_0.1.2      
[13] lubridate_1.9.5    forcats_1.0.1      stringr_1.6.0      dplyr_1.2.1       
[17] purrr_1.2.2        readr_2.2.0        tidyr_1.3.2        tibble_3.3.1      
[21] ggplot2_4.0.3      tidyverse_2.0.0    pacman_0.5.1      

loaded via a namespace (and not attached):
 [1] gtable_0.3.6       xfun_0.60          httr2_1.3.0        htmlwidgets_1.6.4 
 [5] gh_1.6.1           tzdb_0.5.0         vctrs_0.7.3        tools_4.6.1       
 [9] generics_0.1.4     parallel_4.6.1     curl_7.1.0         pkgconfig_2.0.3   
[13] RColorBrewer_1.1-3 S7_0.2.2           lifecycle_1.0.5    compiler_4.6.1    
[17] farver_2.1.2       textshaping_1.0.5  repr_1.1.7         codetools_0.2-20  
[21] snakecase_0.11.1   litedown_0.10      htmltools_0.5.9    yaml_2.3.12       
[25] crayon_1.5.3       pillar_1.11.1      magick_2.9.1       commonmark_2.0.0  
[29] tidyselect_1.2.1   digest_0.6.39      stringi_1.8.7      rprojroot_2.1.1   
[33] fastmap_1.2.0      grid_4.6.1         cli_3.6.6          magrittr_2.0.5    
[37] base64enc_0.1-6    withr_3.0.3        bit64_4.8.2        timechange_0.4.0  
[41] rmarkdown_2.31     tidytuesdayR_1.3.2 gitcreds_0.1.2     bit_4.6.0         
[45] otel_0.2.0         ragg_1.5.2         hms_1.1.4          evaluate_1.0.5    
[49] knitr_1.51         markdown_2.0       rlang_1.3.0        gridtext_0.1.6    
[53] Rcpp_1.1.2         xml2_1.6.0         vroom_1.7.1        rstudioapi_0.19.0 
[57] jsonlite_2.0.0     R6_2.6.1           fs_2.1.0           systemfonts_1.3.2 

9. GitHub Repository

TipExpand for GitHub Repo

The complete code for this analysis is available in tt_2026_36.qmd.

For the full repository, click here.

10. References

TipExpand for References
  1. Data Source:
    • TidyTuesday 2026 Week 36: The Cappuccino Index

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 = {Cheap Coffee Isn’t Necessarily Affordable Coffee},
  date = {2026-09-07},
  url = {https://stevenponce.netlify.app/data_visualizations/TidyTuesday/2026/tt_2026_36.html},
  langid = {en}
}
For attribution, please cite this work as:
Ponce, Steven. 2026. “Cheap Coffee Isn’t Necessarily Affordable Coffee.” September 7. https://stevenponce.netlify.app/data_visualizations/TidyTuesday/2026/tt_2026_36.html.
Source Code
---
title: "Cheap coffee isn't necessarily affordable coffee"
subtitle: "The Cappuccino Index measures the minutes a barista must work to afford a small cappuccino. Across these countries, barista wages vary far more than cappuccino prices."
description: "An annotated scatter plot comparing mean hourly barista wages to mean cappuccino prices across 87 countries, using the Cappuccino Index (minutes of work per cappuccino) with iso-affordability contour lines at 30/60/120 minutes. Pakistan and India show cheap coffee but extreme work-time costs due to low wages, while Switzerland and Denmark show expensive coffee but low work-time costs due to high wages. Built in R with ggplot2, geomtextpath, and ggrepel."
date: "2026-09-07"
author:
  - name: "Steven Ponce"
    url: "https://stevenponce.netlify.app"
citation:
  url: "https://stevenponce.netlify.app/data_visualizations/TidyTuesday/2026/tt_2026_36.html"
categories: ["TidyTuesday", "Data Visualization", "R Programming", "2026"]
tags: [
  "TidyTuesday",
  "Scatter Plot",
  "Coffee",
  "Economics",
  "Affordability",
  "Wages",
  "Cross-Country Comparison",
  "R",
  "ggplot2",
  "geomtextpath",
  "ggrepel",
  "Log Scale",
  "Annotation",
  "2026"
]
image: "thumbnails/tt_2026_36.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
---

![Scatter plot titled "Cheap coffee isn't necessarily affordable coffee," plotting mean hourly barista wage against mean cappuccino price across 87 countries on log-log axes, with dashed diagonal lines marking equal work-time cost at 30, 60, and 120 minutes. Pakistan (£1.87 cappuccino, 277 minutes of work) and India (£1.96, 172 minutes) sit far left with cheap coffee but extreme work-time burdens driven by very low wages. Switzerland and Denmark, both averaging £5.41 per cappuccino, require only 14 and 19 minutes, respectively, reflecting high wages. The remaining gray points cluster loosely along the diagonal. Source: James Hoffmann via Filip Reierson.](tt_2026_36.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({
if (!require("pacman")) install.packages("pacman")
pacman::p_load(
    tidyverse, ggtext, showtext, janitor, ggrepel,      
    scales, glue, skimr, ggview, geomtextpath
    )
})

# 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

## 2. READ IN THE DATA ----
tt <- tidytuesdayR::tt_load(2026, week = 36)
cafe <- tt$cafe
cappuccino_index <- tt$cappuccino_index
rm(tt)
```

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

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

## 3. EXAMINING THE DATA ----
glimpse(cafe)
skim_without_charts(cafe)
glimpse(cappuccino_index)
skim_without_charts(cappuccino_index)
```

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

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

# Country-level means — 
driver_diag <- cafe |>
    group_by(country) |>
    summarise(
        n = n(),
        mean_price = mean(price_gbp),
        mean_wage  = mean(hourly_wage_gbp),
        .groups = "drop"
    ) |>
    left_join(
        cappuccino_index |> select(country, published_index = index),
        by = "country"
    )

# Primary contrast -
primary_countries <- c("India", "Pakistan", "Switzerland", "Denmark")

# Winning contour set from cheap-render testing: 30 / 60 / 120 -
iso_lines <- tibble(
    index_level = c(30, 60, 120),
    intercept   = log(index_level / 60),
    contour_label = paste0(index_level, " min")
)
```

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

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

### |- plot aesthetics ----
colors <- get_theme_colors(
    palette = c(highlight = "#722F37", secondary = "gray70")
)

### |- titles and caption ----
title_text <- str_glue("Cheap coffee isn't necessarily affordable coffee")

subtitle_line1 <- "The **Cappuccino Index** measures the minutes a barista must work to afford a small cappuccino." |>
    str_wrap(width = 100) |>
    str_replace_all("\n", "<br>")

subtitle_line2 <- "Across these countries, barista wages vary far more than cappuccino prices." |>
    str_wrap(width = 90) |>
    str_replace_all("\n", "<br>")

subtitle_text <- str_glue("{subtitle_line1}<br>{subtitle_line2}")

caption_source <- "James Hoffmann via Filip Reierson. Index = 60 x mean price / mean wage per country. Cross-country dispersion (log scale): barista wages vary 2.5x more than cappuccino prices." |>
    str_wrap(width = 100) |>
    str_replace_all("\n", "<br>")

caption_text <- create_social_caption(
    tt_year = 2026,
    tt_week = 36,
    source_text = caption_source
)

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

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

weekly_theme <- extend_weekly_theme(
  base_theme,
  theme(
    plot.title = element_textbox_simple(
      size = 20,
      face = "bold",
      family = fonts$title_1,
      color = colors$title,
      lineheight = 1.1,
      margin = margin(b = 8)
    ),
    plot.subtitle = element_textbox_simple(
      size = 12.5,
      family = fonts$subtitle,
      color = colors$subtitle,
      margin = margin(b = 20)
    ),
    plot.caption = element_textbox_simple(
      size = 6.0,
      family = fonts$caption,
      color = colors$caption,
      margin = margin(t = 12)
    ),
    panel.grid.minor = element_blank(),
    panel.grid.major = element_line(color = "gray92", linewidth = 0.25)
  )
)

theme_set(weekly_theme)
```

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

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

### |- plot ----
p <- driver_diag |>
    ggplot(aes(x = mean_wage, y = mean_price)) +
    geom_textabline(
        data = iso_lines,
        aes(slope = 1, intercept = intercept, label = contour_label),
        color = "gray55", linetype = "dashed", linewidth = 0.35,
        size = 2.8, hjust = 0.88, text_smoothing = 0
    ) +
    geom_point(alpha = 0.45, color = "gray55", size = 1.8) +
    geom_point(
        data = driver_diag |> filter(country %in% primary_countries),
        color = "#722F37", size = 3
    ) +
    geom_text_repel(
        data = driver_diag |> filter(country %in% primary_countries),
        aes(label = country),
        size = 3.4, fontface = "plain", color = "#2C2825",
        min.segment.length = 0, seed = 1234,
        box.padding = 0.5, point.padding = 0.3, force = 2, max.overlaps = Inf
    ) +
    annotate(
        "richtext",
        x = 0.6, y = 1.5,
        label = "**Cheap, but not affordable**<br>India \u00b7 £1.96 \u2192 172 min<br>Pakistan \u00b7 £1.87 \u2192 277 min",
        hjust = 0, size = 3.1, color = "#2C2825",
        fill = NA, label.color = NA
    ) +
    annotate(
        "richtext",
        x = 7, y = 4.3,
        label = "**Expensive, but relatively affordable**<br>Switzerland \u00b7 £5.41 \u2192 14 min<br>Denmark \u00b7 £5.41 \u2192 19 min",
        hjust = 0, size = 3.1, color = "#2C2825",
        fill = NA, label.color = NA
    ) +
    scale_x_log10(labels = scales::label_currency(prefix = "£")) +
    scale_y_log10(labels = scales::label_currency(prefix = "£")) +
    labs(
        title = title_text,
        subtitle = subtitle_text,
        caption = caption_text,
        x = "Mean hourly wage (log scale)",
        y = "Mean cappuccino price (log scale)"
    )
```

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

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

### |- save ----
main_path  <- here::here("data_visualizations", "TidyTuesday", "2026", "tt_2026_36.png")
thumb_path <- here::here("data_visualizations", "TidyTuesday", "2026", "thumbnails", "tt_2026_36.png")

# Full-size version, for the QMD figure
save_ggplot(
  plot = p,
  file = main_path,
  width = 10,
  height = 7.5,
  units = "in",
  dpi = 300,
  create.dir = TRUE
)

# Reduced-size thumbnail, for the YAML `image:` field
fs::dir_create(dirname(thumb_path))
magick::image_read(main_path) |>
  magick::image_resize("400") |>
  magick::image_write(thumb_path)
```


#### [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 [`tt_2026_36.qmd`](https://github.com/poncest/personal-website/blob/master/data_visualizations/TidyTuesday/2026/tt_2026_36.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 Source:**
    -   TidyTuesday 2026 Week 36: [The Cappuccino Index](https://github.com/rfordatascience/tidytuesday/blob/main/data/2026/2026-09-08/readme.md)

:::


#### [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