2 min read

Brontosaurus Charts

This is distribution plot using ridges to show the four factors on offense for Carolina basketball in the 2020-21 season.

The plot is annotated to show the median values of each ridge, and the lines use quantiles.

The goal of this graph was to try to show the consistency in certain factors, especially turnover rate.

Code is below . . .

library(tidyverse)
library(ggridges)

ggplot(data, aes(x = value, y = factor, fill = factor)) +
 stat_density_ridges(quantile_lines = TRUE, quantiles = 2) +
  theme_me() +
  theme(legend.position = "none") +
  scale_x_continuous(breaks = seq(0,70,10), limits = c(0,70)) +
   labs(
    x = "Value",
    y = "Four Factors",
    title = "Carolina Offense: Four Factors for all games in 2020-21",
    subtitle ="Median values shown as labels underneath each factor.",
    caption = "@dadgumboxscores"
  ) +
  annotate(
    geom = 'label',
    x = 20,
    y = 'TORate',
    vjust = 1,
    label = "20.8 turnover rate",
    fill = "#56a0d3",
    alpha = .5
  ) +
  annotate(
    geom = 'label',
    x = 39.8,
    y = 'ORRate',
    vjust = 1,
    label = "39.75 rebounding rate",
    fill = "#56a0d3",
    alpha = .5
  ) +
  annotate(
    geom = 'label',
    x = 33,
    y = 'FTRate',
    vjust = 1,
    label = "33.1 free throw rate",
    fill = "#56a0d3",
    alpha = .5
  ) +
  annotate(
    geom = 'label',
    x = 46,
    y = 'eFG',
    vjust = 1,
    label = "46.4 effective field goal percentage",
    fill = "#56a0d3",
    alpha = .5
  )