2 min read

Background Biscuits

This is bar plot with labels showing the number of games with 100 points or more scored since the 2004 season for the North Carolina men’s basketball team. The Tar Heels failed to score 100 or more points in 33 games during the 2019-20 season. The first time ever in the Roy Williams Era.

Carolina has a promotion with Bojangles for fans to receive free bisucits when 100 or more points are scored. This is why we slapped a background image of a sausage biscuit on the plot.

This uses the ggplot2 package, the economist theme, and the png and grid packages. All data is via my Shiny app, app.dadgumboxscores.com.

Code is below . . .

library(tidyverse)
library(png)
library(grid)
library(ggthemes)
bis <- tibble::tribble(
~Season,~Total,
2004,4,
2005,6,
2006,1,
2007,7,
2008,8,
2009,9,
2010,1,
2011,4,
2012,4,
2013,2,
2014,1,
2015,2,
2016,2,
2017,6,
2018,2,
2019,6,
2020,0
)

img <- readPNG("bojang.png")
  
biscuit_background <- png::readPNG("bojang.png")

ggplot(bis, aes(Season, Total)) +
  ggtitle("Carolina: Games with 100 or Points Scored by Season Since 2004") +
  scale_fill_continuous(guide = FALSE) +
  annotation_custom(rasterGrob(biscuit_background, 
                               width = unit(1/2,"npc"), 
                               height = unit(1/2,"npc")), 
                    -Inf, Inf, -Inf, Inf) +
  geom_bar(stat="identity", fill = "#13294B", position = "dodge", width = .75, colour = '#13294B') +
  scale_y_continuous(breaks=seq(0,10,1)) +
  scale_x_continuous(breaks=seq(2004,2020,1)) +
  labs(caption = "Source: app.dadadgumboxscores.com | Image: Bojangles") +
   xlab("Season") +
   ylab("Number of games over 100 points scored") +
  geom_text(aes(label = round(Total)), size = 5, fontface = 2, 
            colour = 'black', hjust = 0.5, vjust = -1, family="OfficinaSanITC-Book") + 
            theme_economist() + scale_fill_economist() +
  theme(plot.title=element_text(family="OfficinaSanITC-Book"),
        text=element_text(family="OfficinaSanITC-Book"))