1 min read

Turnover Frequency

This is a plot showing the frequency of turnover rates in the Roy Williams Era since 2010. It uses geom_smooth and annotates that Carolina has had a turnover rate of 20 or higher in 5 of 6 games thus far.

library(ggplot2)
library(ggthemes)
library(dplyr)

data <- read.csv('efgto.csv')

theme_me <- function () {
  theme_minimal(base_size = 15, base_family = "RobotoCondensed-Regular") %+replace%
    theme (
      plot.title = element_text(hjust = 0.5),
      plot.subtitle = element_text(
        hjust = 0.5,
        vjust = -2,
        lineheight = 0.9,
        size = 10
      ),
      plot.caption = element_text(size = 8, hjust = 1),
      panel.grid.minor = element_blank(),
      plot.background = element_rect(fill = "#c9e1f1", color = "#c9e1f1")
    )
}

ggplot(data, aes(x = season, y = to)) +
  geom_point(color = "#13294B") +
  geom_smooth(
    method = "loess",
    formula = y ~ x,
    size = 1,
    color = "#4B9CD3"
  ) + theme_me() +
  scale_x_continuous(breaks = seq(2010, 2021, 1)) +
  scale_y_continuous(breaks = seq(0, 35, 5)) +
  annotate(
    "text",
    x = 2021,
    y = 30,
    label = "20+ TO% in 5 of 6 \n Games!",
    family = "Chalkboard Bold",
    size = 3.5,
    color = "#EF426F"
  ) +
  labs(
    x = "Season",
    y = "Turnover Rate (Offense)",
    title = "Carolina Offense: Turnover Rates for All Games in Roy Williams Era 
    Since 2010 (412 games)",
    caption = "@dadgumboxscores"
  )