unc_trd |>
ggplot2::ggplot(ggplot2::aes(x = distance, y = yards_gained)) +
ggplot2::geom_jitter(data = unc_trd |> dplyr::filter(conv == "No"),
mapping = ggplot2::aes(x = distance, y = yards_gained),
stroke = 0.8,
color = "#e41a1c",
size = 3,
shape = 1
) +
ggplot2::geom_jitter(
data = unc_trd |> dplyr::filter(conv == "Yes"),
mapping = ggplot2::aes(x = distance, y = yards_gained),
stroke = 0.8,
fill = "#4daf4a",
size = 4,
shape = 21
) +
ggplot2::scale_x_continuous(breaks = seq(0, 25, 5), limits = c(0, 25)) +
ggplot2::scale_y_continuous(breaks = seq(-10, 60, 10), limits = c(-10, 60)) +
theme_me() +
ggplot2::theme(legend.position = "none", plot.title = ggtext::element_markdown()) +
ggplot2::labs(
x = "3rd Down Distance",
y = "Yards Gained",
title = "North Carolina Offense: Third Downs \n<span style='color:#4daf4a;'>converted</span> | <span style='color:#e41a1c;'>not converted</span>",
caption = "Bless your chart | September 18, 2023 | data via cfbfastR"
) +
ggplot2::geom_vline(xintercept = 6.42,
linetype = 'dashed',
color = "#333333") -> plot_one
full_plot <- plot_one +
ggplot2::annotate(
cfbplotR::GeomCFBlogo,
x = 22.5,
y =50,
team = "North Carolina",
height = .075,
alpha = 0.6
) +
ggplot2::annotate(
geom = "label",
x = 22.5,
y = 42,
color = "#333333",
fill = "#56a0d3",
label = "3rd down conversions \n28-of-43 (65.1%) \n2nd in FBS",
size = 4,
fontface = 'bold',
family = 'mono',
alpha = 0.3
) +
ggplot2::annotate(
geom = "label",
x = 2.5,
y = 45,
color = "#333333",
fill = "#56a0d3",
label = "24-of-29 (82.8%) \n5 yards or shorter",
size = 3.5,
fontface = 'bold',
family = 'mono',
alpha = 0.3
) +
ggplot2::annotate(
geom = "label",
x = 17.5,
y = 0,
color = "#333333",
fill = "#56a0d3",
label = "4-of-14 (28.6%) \n6 yards or longer",
size = 3.5,
fontface = 'bold',
family = 'mono',
alpha = 0.3
) +
ggplot2::annotate(
geom = "text",
x = 9,
y = 34,
color = "#333333",
label = "Avgerage distance \n6.42 yards",
size = 3,
fontface = 'bold',
family = 'mono',
)
ggplot2::ggsave(
"trd.png",
full_plot,
w = 9,
h = 8.5,
dpi = 600,
type = 'cairo'
)
full_plot