Skip to content

Commit a941093

Browse files
20250228 - plot annotation
1 parent 214c467 commit a941093

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

sports-cognitive-psychology.qmd

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,23 @@ ggplot2::ggplot(
157157
y = "Proportion of 4th Down Plays that\nare Attempts (to Get the First Down)",
158158
title = "4th Down Attempts (Proportion) by Season",
159159
) +
160-
theme(axis.title.y = element_text(angle = 0, vjust = 0.5)) # horizontal y-axis title
160+
theme(axis.title.y = element_text(angle = 0, vjust = 0.5)) + # horizontal y-axis title
161+
annotate(
162+
"segment",
163+
x = 2015,
164+
xend = 2017,
165+
y = 0.08,
166+
yend = 0.123,
167+
color = "blue",
168+
linewidth = 1.5,
169+
alpha = 0.6,
170+
arrow = arrow()) +
171+
annotate(
172+
"text",
173+
x = 2015,
174+
y = 0.07,
175+
label = "Rapid increases in 4th down\nattempts after the 2017 season",
176+
hjust = 0.5) # center
161177
```
162178

163179
As depicted in the @fig-goForItPercentageByWinProbChange (which was adapted from a [figure by Ben Baldwin](https://www.nfl4th.com/articles/4th-down-research.html); archived at <https://perma.cc/S5D8-3NCU>), teams went for it on fourth down nearly twice as often in 2021 compared to 2017, when when their win probability was at least 20% (given the current situation at the start of the given play) and they would increase their win probably by going for it.
@@ -173,7 +189,7 @@ text_df <- tibble(
173189
"NFL coaches<br>in <span style='color:#00BFC4'>**2021**</span>",
174190
"NFL coaches<br>in <span style='color:#F8766D'>**2017**</span>"),
175191
x = c(5, 7),
176-
y = c(90, 20),
192+
y = c(87.5, 22.5),
177193
angle = c(10, 10),
178194
color = c("black", "black")
179195
)

0 commit comments

Comments
 (0)