pd_plot <- scores_only |>
ggplot2::ggplot(ggplot2::aes(x = season)) +
ggbeeswarm::geom_quasirandom(
data = scores_only |> dplyr::filter(result == "L"),
mapping = ggplot2::aes(y = point_diff, x = season),
stroke = 0.8,
color = "#e41a1c",
size = 3,
shape = 1
) +
ggbeeswarm::geom_quasirandom(
data = scores_only |> dplyr::filter(result == "W"),
mapping = ggplot2::aes(y = point_diff, x = season),
stroke = 0.8,
fill = "#4daf4a",
size = 3,
shape = 21
) +
ggplot2::scale_y_continuous(limits = c(0, 70), labels = c("0", "3", "7", "10", "14", "17", "21", "24", "28", "points or more"), breaks = c(0, 3, 7, 10, 14, 17, 21, 24, 28, 37)) +
ggplot2::scale_x_continuous(breaks = seq(2005, 2023, 1)) +
ggplot2::coord_flip() +
theme_me() +
ggplot2::theme(legend.position = "none",
plot.title = ggtext::element_markdown(),
plot.caption = ggtext::element_markdown(size = 10, face ='bold', family = 'mono'),
axis.text.x = ggtext::element_markdown(size = 12, face ='bold', family = 'mono'), axis.text.y = ggtext::element_markdown(size = 12, face ='bold', family = 'mono'),
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()) +
ggplot2::geom_vline(xintercept = c(2005.5, 2006.5, 2007.5, 2008.5, 2009.5, 2010.5, 2011.5, 2012.5, 2013.5, 2014.5, 2015.5, 2016.5, 2017.5, 2018.5, 2019.5, 2020.5, 2021.5, 2022.5),
color = "#acacac", linetype = "dashed") +
ggplot2::labs(x = "",
y = "",
title = "ACC football \nmargin of victory by season \nhome team: <span style='color:#4daf4a;'>win</span> | <span style='color:#e41a1c;'>loss</span>",
caption = "Bless your chart | November 4 | data via cfbfastR"
) +
ggplot2::annotate(
geom = "text",
x = 2020,
y = 60,
color = "#333333",
label = "COVID",
size = 4,
fontface = 'bold',
family = 'mono'
)
ggplot2::ggsave(
"pd_plot.png",
pd_plot,
w = 8.5,
h = 9.5,
dpi = 600,
type = 'cairo'
)
pd_plot