library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.4.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(cfbplotR)
library(ggplot2)
library(ggrepel)
library(cfbfastR)
passing_pressure <- read.csv("passing_pressure.csv")
Minimum 30 base dropbacks
passing_pressure <- passing_pressure %>% select(player, team_name, base_dropbacks, blitz_grades_pass, no_blitz_grades_pass) %>% filter (base_dropbacks >= 30)
plot <- passing_pressure %>% ggplot(aes(x=no_blitz_grades_pass, y=blitz_grades_pass)) + geom_vline(xintercept = mean(ifelse(passing_pressure$base_dropbacks >= 30, passing_pressure$no_blitz_grades_pass, NA), na.rm = TRUE), color = "red", linetype = "dashed") + geom_hline(yintercept = mean(ifelse(passing_pressure$base_dropbacks >= 30, passing_pressure$blitz_grades_pass, NA), na.rm = TRUE), color = "red", linetype = "dashed") + geom_text_repel(aes(label = player), vjust = -0.7, hjust = 0.7, size = 2, max.overlaps = 20) + scale_size_continuous(range = c(2, 4)) + geom_cfb_logos(aes(team = team_name), width = 0.02) + ylab("Passing Grade Under Pressure") + xlab("Passing Grade in Clean Pocket") + labs(caption = "Data: PFF") + theme(plot.caption = element_text(size = 10, hjust = 1, vjust = 1, color = "gray40"))
plot
## Warning: Abbreviations not found in `team_name_mapping`: SAM HOUSTON
## Warning: SAM HOUSTON is not a valid team name (row 4)
## Warning: Abbreviations not found in `team_name_mapping`: DELAWARE
## Warning: DELAWARE is not a valid team name (row 29)
## Warning: Abbreviations not found in `team_name_mapping`: KENNESAW STATE
## Warning: KENNESAW STATE is not a valid team name (row 37)
## Warning: Abbreviations not found in `team_name_mapping`: JACKSONVILLE STATE
## Warning: JACKSONVILLE STATE is not a valid team name (row 66)