defense_plot <- def_drive %>%
mutate(offense = fct_relevel(offense, c("Florida A&M", "Appalachian State", "Georgia State", "Notre Dame", "Virginia Tech", "Miami", "Duke", "Pittsburgh", "Virginia", "Wake Forest"))) %>%
ggplot(aes(x = offense, y = count, fill = count)) +
geom_bar(stat = "identity", colour = "black") +
labs(y="Drive number", x = "") +
scale_y_continuous(breaks = seq(0, 20, 1)) +
coord_flip() +
theme_me() +
theme(axis.text.y = element_cfb_logo(size = 1), legend.position = "none") +
labs(title = "Carolina Defense: scoring and non-scoring drives by game",
subtitle = "Carolina blue denotes an empty drive by the opponent. Navy means a scoring drive (3 or more points).",
caption = "@dadgumboxscores | November 11, 2022 | data via cfbfastR") +
annotate(
"text",
x = 8.5,
y = 14,
label = "3 or more \n consecutive stops \n in every ACC game!",
family = "Chalkboard Bold",
size = 4,
color = "red"
) +
annotate(
"text",
x = 4.8,
y = 14,
label = "App State and \n Notre Dame \n scored on SIX \n consecutive drives",
family = "Chalkboard Bold",
size = 4,
color = "red"
) +
annotate(
geom = "curve",
color = "red",
x = 2,
y = 14.2,
xend = 3.9,
yend = 14,
curvature = .3,
arrow = arrow(length = unit(2, "mm"))
)
# save plot
ggsave(
"def.png",
defense_plot,
w = 10.5,
h = 7.5,
dpi = 300,
type = 'cairo'
)
defense_plot