美食奥斯卡数据探索-James Beard Awards

Tidytuesday 2025 Week 1

Author

Lee

Published

April 15, 2025

1 准备数据

library(tidyverse)
library(camcorder)

file_path <- "d:/myblog/posts/ggplot2-tidytuesday-2025week1/tech/james-beard-awards.csv"

jb_awards <- read_csv(
  file_path
)

1.1 数据清洗

jb_totals <- jb_awards %>%
  select(-recipient_id) %>%
  distinct() %>% # remove duplicate recipients
  # group by recipient_name and count the number of awards
  add_count(recipient_name, name = "total") %>%
  group_by(recipient_name) %>%
  mutate(
    first_year = min(year, na.rm = TRUE), # 首次获奖年份
    last_year = max(year, na.rm = TRUE), # 最后获奖年份
    years_since_first = year - first_year, # 首次获奖年份至今年份的年数
    cumsum_n = row_number() # 每个获奖记录分配一个行号,即为累计获奖数
  ) %>%
  ungroup()

showtext::showtext_auto()

2 数据可视化

p <- ggplot(
  jb_totals,
  aes(x = years_since_first, y = cumsum_n, group = recipient_name)
) +
  # Non-highlighted
  geom_step(
    data = . %>% filter(total < 25),
    linewidth = 0.15,
    color = "grey50"
  ) +
  # Highlighted
  geom_step(
    data = . %>% filter(total >= 25 | last_year - first_year >= 30),
    aes(color = recipient_name),
    linewidth = 0.5
  ) +
  # All nominations
  geom_point(
    data = . %>% filter(total >= 25 | last_year - first_year >= 30),
    aes(color = recipient_name),
    size = 1
  ) +
  # winner stars
  shadowtext::geom_shadowtext(
    data = . %>%
      filter(
        (total >= 25 | last_year - first_year >= 30) & award_status == "Winner"
      ),
    aes(color = recipient_name, label = "★", bg.color = "grey99")
  ) +
  shadowtext::geom_shadowtext(
    data = . %>%
      filter((total >= 25 | last_year - first_year >= 30) & year == last_year),
    aes(color = recipient_name, label = recipient_name),
    bg.color = "grey99",
    hjust = 0,
    nudge_x = 0.5,
    vjust = 0.2,
    fontface = "bold"
  ) +
  scale_linewidth_identity() +
  MetBrewer::scale_color_met_d("Redon") +
  coord_cartesian(clip = "off", xlim = c(0, 37)) +
  labs(
    title = "James Beard Awards",
    subtitle = str_wrap(
      "Tracking the most decorated nominees and those with the longest spans from first to last nomination (1991-2024). Stars (★) indicate winning years, points show all nominations. Featuring Alan Richman (35 nominations, 17 journalism wins), Steve Dolinsky (27 nominations, 13 broadcast wins), Commander's Palace (6 nominations over 30 years, Service & Restaurant wins), Ruth Reichl (12 nominations, Lifetime Achievement & journalism award), and John B. Shields (5 nominations spanning 1991-2024, from Chesapeake Bay Cookbook to Smyth's Outstanding Chef nomination).",
      148
    ),
    caption = "Source: James Beard Foundation · Graphic: Georgios Karamanis",
    x = "Years since first nomination",
    y = "Cumulative nominations"
  ) +
  theme_minimal() +
  theme(
    legend.position = "none",
    plot.background = element_rect(fill = "grey99", color = NA),
    plot.margin = margin(10, 10, 10, 10),
    plot.title = element_text(
      size = 18,
      face = "bold"
    )
  )

p

ggsave(
  "p.png",
  p,
  width = 12,
  height = 8,
  dpi = 300,
  units = "in"
)