receiving_scheme_week10 <- read.csv("receiving_scheme.csv")
library(ggplot2)
library(ggrepel)
library(nflplotR)
## Warning: package 'nflplotR' was built under R version 4.4.3
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
## ✔ lubridate 1.9.3 ✔ tibble 3.2.1
## ✔ purrr 1.0.2 ✔ tidyr 1.3.1
## ── 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
plot the grades and yards/route run (minimum 15 man targets)
man_grade_yprr <- receiving_scheme_week10 %>% filter(man_targets >= 15, position == "WR") %>%
ggplot(aes(x=man_grades_pass_route, y=man_yprr)) + geom_vline(xintercept = mean(ifelse(receiving_scheme_week10$position == "WR" & receiving_scheme_week10$man_targets >=15, receiving_scheme_week10$man_grades_pass_route, NA), na.rm = TRUE), color = "red", linetype = "dashed") + geom_hline(yintercept = mean(ifelse(receiving_scheme_week10$position == "WR" & receiving_scheme_week10$man_targets >=15, receiving_scheme_week10$man_yprr, NA), na.rm = TRUE), color = "red", linetype = "dashed") + geom_text_repel(aes(label = player), vjust = -0.5, hjust = 0.5, size = 2, max.overlaps = 20) + scale_size_continuous(range = c(2, 4)) + geom_nfl_logos(aes(team_abbr = team_name), width = 0.02) + ylab("YPRR vs Man") + xlab("Receiving Grade vs Man (PFF)") + labs(caption = "Data: PFF") + theme(plot.caption = element_text(size = 10, hjust = 1, vjust = 1, color = "gray40"))
man_grade_yprr
plot the grades an yards/route run (minimum 35 base targets)
man_grade_yprr <- receiving_scheme_week10 %>% filter(base_targets >= 35, position == "WR") %>%
ggplot(aes(x=man_grades_pass_route, y=man_yprr)) + geom_vline(xintercept = mean(ifelse(receiving_scheme_week10$position == "WR" & receiving_scheme_week10$base_targets >= 35, receiving_scheme_week10$man_grades_pass_route, NA), na.rm = TRUE), color = "red", linetype = "dashed") + geom_hline(yintercept = mean(ifelse(receiving_scheme_week10$position == "WR" & receiving_scheme_week10$base_targets >= 35, receiving_scheme_week10$man_yprr, NA), na.rm = TRUE), color = "red", linetype = "dashed") + geom_text_repel(aes(label = player), vjust = -0.5, hjust = 0.5, size = 2, max.overlaps = 20) + scale_size_continuous(range = c(2, 4)) + geom_nfl_logos(aes(team_abbr = team_name), width = 0.02) + ylab("YPRR vs Man") + xlab("Receiving Grade vs Man (PFF)") + labs(caption = "Data: PFF") + theme(plot.caption = element_text(size = 10, hjust = 1, vjust = 1, color = "gray40"))
man_grade_yprr
man_grade_yprr <- receiving_scheme_week10 %>% filter(base_targets >= 35, position == "WR") %>%
ggplot(aes(x=man_grades_pass_route, y=man_yprr)) + geom_vline(xintercept = mean(ifelse(receiving_scheme_week10$position == "WR" & receiving_scheme_week10$base_targets >= 35, receiving_scheme_week10$man_grades_pass_route, NA), na.rm = TRUE), color = "red", linetype = "dashed") + geom_hline(yintercept = mean(ifelse(receiving_scheme_week10$position == "WR" & receiving_scheme_week10$base_targets >= 35, receiving_scheme_week10$man_yprr, NA), na.rm = TRUE), color = "red", linetype = "dashed") + geom_text_repel(aes(label = player), vjust = -0.5, hjust = 0.5, size = 2, max.overlaps = 20) + scale_size_continuous(range = c(2, 4)) +
geom_point(aes(color = team_name, fill = team_name), shape = 21, size = 2, stroke = 1) +
scale_color_nfl(type = "secondary") +
scale_fill_nfl(type = "primary", alpha = 0.8) +
ylab("YPRR vs Man") + xlab("Receiving Grade vs Man (PFF)") + labs(caption = "Data: PFF") + theme(plot.caption = element_text(size = 10, hjust = 1, vjust = 1, color = "gray40"))
man_grade_yprr