library(tidyverse)
library(waffle)
library(patchwork)
emmys <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-09-21/nominees.csv") %>%
mutate(distributor = recode(distributor, "HBO Max" = "HBO")) %>%
filter(distributor %in% c("Netflix", "HBO")) %>%
group_by(year, type, distributor) %>%
count() %>%
ungroup() %>%
arrange(desc(type))
plot_emmy_waffle <- function(df, emmy_year) {
df %>%
filter(year == emmy_year) %>%
ggplot() +
geom_waffle(aes(fill = type, values = n), color = "#353454", n_rows = 10, size = 0.4, flip = TRUE) +
facet_wrap(~ distributor, nrow = 1, strip.position = "bottom") +
coord_equal(clip = "off") +
scale_fill_manual(values = c("#62619D", "#FAD6A7")) +
scale_y_continuous(labels = NULL, limits = c(0, 45)) +
scale_x_continuous(labels = NULL) +
labs(title = emmy_year) +
guides(fill = FALSE) +
theme(
plot.title = element_text(family = "Inter-Medium", color = "#474670", size = 48, hjust = 0.5, margin = margin(0, 0, -0.5, 0, unit = "line")),
strip.text = element_text(family = "Inter-Medium", size = 30),
panel.grid.major.x = element_blank(),
panel.grid.major.y = element_blank(),
panel.grid.minor.x = element_blank(),
panel.grid.minor.y = element_blank(),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.text.x = element_blank(),
axis.text.y = element_blank()
)
}
(
plot_emmy_waffle(emmys, 2015) +
plot_emmy_waffle(emmys, 2018) +
plot_emmy_waffle(emmys, 2021)
) +
plot_annotation(
title = '"Are You Still Watching?" Netflix beats HBO at the 2021 Emmy Awards',
subtitle = "HBO and Netflix have been in close competition for Emmy dominance in recent years. But 6 years ago that was not\nthe case – HBO won 140 of 359 (38%) Emmy nominations at the 2015 Emmy Awards, Netflix won just 5 of 84 (6%).\nIn 2018, Netflix was more competitive, winning 68 Emmys versus HBO's 96. In 2021, Netflix finally surpassed HBO,\nwinning 112 of 416 (27%) nominations versus HBO's 72 of 440 (16%)",
caption = "Source data from emmys.com\nRecreate this graphic at nsgrantham.com/emmys",
theme = theme(
plot.title = element_text(family = "Inter-SemiBold", size = 36, margin = margin(0, 0, 0.7, 0, unit = "line")),
plot.subtitle = element_text(family = "Inter-Light", size = 23, lineheight = 1.1),
plot.caption = element_text(family = "Inter-Light", size = 18, margin = margin(1, 0, 0, 0, unit = "line")),
plot.margin = margin(2, 2, 2, 2, unit = "line")
)
)
ggsave("emmys.png", width = 18, height = 14)