diff_chart <- acc_diffs %>% ggplot(aes(
x = diff,
y = value,
group = team,
color = team,
alpha = 1
)) +
geom_line(size = 0.5, color = "grey75") +
geom_line(
data = acc_diffs %>% filter(team %in% c("North Carolina", "Miami (FL)")),
mapping = aes(
x = diff,
y = value,
group = team,
color = team,
alpha = 1
),
size = 4
) + scale_x_discrete(expand = expansion(mult = c(0, 0.5)), position = "top") +
scale_y_continuous(breaks = seq(-40, 40, 10)) +
scale_color_manual(values = c("#F47321", "#56a0d3")) +
annotate(
geom = "label",
x = 2,
y = 40,
label = " Miami \n +38 (Home) \n -33 (Away)",
hjust = -0.1,
vjust = 0.9,
fill = "#F47321",
alpha = 0.1,
size = 4
) +
annotate(
geom = "label",
x = 2,
y = 0,
hjust = -0.1,
label = " North Carolina \n 0 (Home) \n +14 (Away)",
fill = "#56a0d3",
alpha = 0.1,
size = 4,
) +
labs(
x = element_blank(),
y = element_blank(),
title = "Home & Away Run Differential \nin ACC Baseball Games",
caption = "@dadgumboxscores | April 13 | data via baseballR"
) +
theme_fivethirtyeight() +
theme(
panel.grid = element_blank(),
legend.position = "none",
text = element_text(family = "Arial"),
plot.title = element_markdown()
)
# save it
ggsave(
"acc-diffs.png",
diff_chart,
w = 6,
h = 8,
dpi = 600,
type = 'cairo'
)