# make the plot
bama <- ggplot2:: ggplot (bama_data) +
ggplot2:: geom_linerange (ggplot2:: aes (x= fct_reorder (Player, Time), ymin = Start, ymax = Stop), size = 2.4 , color = "#56a0d3" ) +
coord_flip () +
ggplot2:: scale_y_continuous (breaks = c (0 ,600 , 1200 , 1800 , 2400 , 3000 , 3600 ),
labels = c ("1 minute" , "10 minutes" , "Halftime" , "30 Minutes" , "40 minutes" , "50 minutes" , "60 minutes" )) +
ggplot2:: geom_hline (yintercept = c (0 ,1200 ,2400 ,2700 ,3000 ,3300 ,3600 ), color = "gray30" , linetype = "dotted" , size = 0.3 ) +
theme_me () +
theme (plot.title = element_markdown ()) +
labs (
x = "" ,
y = "" ,
title = "Alabama 103, Carolina 101 (4 OT) \n <span style='color:#56a0d3;'>substitution</span> patterns" ,
caption = "data via bigballR | @dadgumboxscores | November 27, 2022"
) +
annotate (
"text" ,
x = 6 ,
y = 1500 ,
label = "4 fouls" ,
family = "Chalkboard Bold" ,
size = 3 ,
color = "red"
) +
annotate (
"text" ,
x = 3.3 ,
y = 2900 ,
label = "Trimble and McKoy \n defensive subs \n for one second" ,
family = "Chalkboard Bold" ,
size = 3 ,
color = "red" ,
angle = 25
) +
annotate (
"text" ,
x = 11.3 ,
y = 3000 ,
label = "Overtimes" ,
family = "Chalkboard Bold" ,
size = 3 ,
color = "red" ,
) +
annotate (
geom = "curve" ,
color = "red" ,
x = 2.6 ,
y = 3000 ,
xend = 1.9 ,
yend = 3550 ,
curvature = .3 ,
arrow = arrow (length = unit (2 , "mm" ))
) +
annotate (
geom = "curve" ,
color = "red" ,
x = 4.3 ,
y = 3000 ,
xend = 4.2 ,
yend = 3550 ,
curvature = - .4 ,
arrow = arrow (length = unit (2 , "mm" ))
) +
annotate (
"text" ,
x = 7 ,
y = 3450 ,
label = "Injury?" ,
family = "Chalkboard Bold" ,
size = 3 ,
color = "red" ,
)
# save the plot
ggsave (
"alabama.png" ,
bama,
w = 7.5 ,
h = 5.5 ,
dpi = 300 ,
type = 'cairo'
)
bama