uva_poss <- acc_poss |>
dplyr::filter(ID == 5629143) |>
dplyr::mutate(scoring = dplyr::if_else(PTS > 0, TRUE, FALSE))
row_index <- which(uva_poss$Half_Status == 2)[1]
first_poss_num <- uva_poss$Poss_Num[row_index] / 2
uva_unc_plot <- uva_poss |>
ggplot2::ggplot(ggplot2::aes(x = Poss_Num / 2, y = Poss_Team, fill = scoring)) +
ggplot2::geom_tile(width = 0.75, height = 0.25) +
ggplot2::scale_fill_manual(values = c("lightpink", "lightgreen")) +
ggplot2::scale_x_continuous(breaks = seq(0, 60, 5), limits = c(0, 65)) +
ggplot2::geom_vline(xintercept = first_poss_num,
linetype = "dashed",
color = "#333333") +
ggplot2::annotate(
"rect",
fill = "yellow",
alpha = 0.35,
xmin = 11.5 / 2,
xmax = 24.5 / 2,
ymin = -Inf,
ymax = Inf
) +
ggplot2::theme_classic() +
ggplot2::theme(legend.position = "none",
axis.text.y = cbbplotR::element_cbb_teams(size = 0.9)) +
ggplot2::labs(
x = "Possessions",
y = "",
title = "North Carolina 54, Virginia 44
\nGreen tile represents scoring possession and pink tile is empty possession.",
caption = "Bless your chart | February 24, 2024 | data via bigballR + cbbplotR"
) +
ggplot2::annotate(
"label",
x = 108 / 2,
y = 1.5,
label = "Points per trip \nNorth Carolina 0.90 \nVirginia 0.73",
size = 3,
color = "#333333",
fill = "floralwhite",
fontface = "bold"
) +
ggplot2::annotate(
"label",
x = 18 / 2,
y = 1.5,
label = "0 points!",
size = 3,
color = "#333333",
fill = "floralwhite",
fontface = "bold"
) +
ggplot2::annotate(
"label",
x = first_poss_num,
y = 2.55,
label = "Halftime",
size = 2.5,
color = "#333333",
fill = "floralwhite",
fontface = "bold"
)
uva_unc_plot