ggplot2::ggplot(unc_drives) +
ggplot2::geom_segment(ggplot2::aes(x = drive_num, xend = drive_num, y = start_yd,
yend = end_yd, color = team_name), size = 1.5,
arrow = ggplot2::arrow(type = "closed",
length = ggplot2::unit(0.07, "inches"))) +
ggplot2::scale_y_reverse(limits = c(120, -20), breaks = seq(-20, 120, 10),
labels = rev(c("", "", "0", "10", "20", "30", "40", "50",
"40", "30", "20", "10", "0", "", ""))) +
ggplot2::scale_x_reverse(limits = c(28, -4), breaks = seq(28, -4, -1),
expand = c(0, -0.5)) +
ggplot2::coord_flip() +
ggplot2::scale_color_manual(values = unc_drive_colors) +
theme_me() +
ggplot2::theme(legend.position = "none",
plot.title = ggtext::element_markdown(),
plot.caption = ggtext::element_markdown(),
panel.grid.major.x = ggplot2::element_line(color = "#E6E6E6", size = 0.5),
panel.grid.minor.x = ggplot2::element_blank(),
panel.grid.major.y = ggplot2::element_blank(),
panel.grid.minor.y = ggplot2::element_blank(),
axis.text.y = ggplot2::element_blank(),
axis.text.x = ggplot2::element_blank(),
axis.title.x = ggplot2::element_text(size = 14, face = "bold")) +
ggplot2::geom_hline(yintercept = c(-10, -20, 110, 120),
color = "floral white") +
ggplot2::geom_vline(xintercept = 20.5,
color = "#333333", linetype = "dashed") +
ggplot2::labs(x = "",
y = "Yard line",
title = "",
caption = caption) +
ggplot2::annotate(
geom = "label",
x = only_unc$drive_num,
y = -14,
label = paste(only_unc$result, "\n",
only_unc$plays, "plays",
only_unc$yards, "yards"),
color = "#333333",
fill = "#56a0d3",
size = 2.3,
fontface = 'bold',
family = 'mono',
alpha = .3,
hjust = 0.5
) +
ggplot2::annotate(
geom = "label",
x = only_app$drive_num,
y = 114,
label = paste(only_app$result, "\n",
only_app$plays, "plays",
only_app$yards, "yards"),
color = "#333333",
fill = "#ffcc00",
size = 2.3,
fontface = 'bold',
family = 'mono',
alpha = .3,
hjust = 0.5
) +
ggplot2::annotate(
cfbplotR::GeomCFBlogo,
x = -2.5,
y = -14,
team = "North Carolina",
height = .075,
) +
ggplot2::annotate(
"text",
x = -0.5,
y = -14,
label = " 3.64 points \nper drive",
fontface = 'bold',
family = 'mono',
size = 3,
color = "#333333"
) +
ggplot2::annotate(
cfbplotR::GeomCFBlogo,
x = -2.5,
y = 114,
team = "Appalachian State",
height = .075,
) +
ggplot2::annotate(
"text",
x = -0.5,
y = 114,
label = " 3.09 points \nper drive",
fontface = 'bold',
family = 'mono',
size = 3,
color = "#333333",
) +
ggplot2::annotate(
"text",
x = 21.3,
y = 50,
label = "OVERTIME",
fontface = 'bold',
family = 'mono',
size = 3,
color = "#333333",
) +
ggtext::geom_richtext(
x = 1.8,
y = -50,
label = unc_scoring_title,
fill = "floral white",
label.color = NA,
size = 5,
label.padding = ggplot2::unit(c(0.7,4.5,0.7,4.5), "lines")
) +
ggplot2::annotate(
geom = "text",
x = 0,
y = c(100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0),
label = c("0", "10", "20", "30", "40", "50",
"40", "30", "20", "10", "0"),
color = "#333333",
size = 4,
fontface = 'bold',
family = 'mono',
hjust = 0.5
) +
ggplot2::annotate(
geom = "text",
x = 27.01,
y = c(100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0),
label = c("0", "10", "20", "30", "40", "50",
"40", "30", "20", "10", "0"),
color = "#333333",
size = 4,
fontface = 'bold',
family = 'mono',
hjust = 0.5
) -> unc_drive_plot
ggplot2::ggsave(
"unc_drive_plot.png",
unc_drive_plot,
h = 8.65,
w = 6.85,
dpi = 600,
type = 'cairo'
)
unc_drive_plot