1 min read

MLB Sans Bubble

Major League Baseball without a bubble is strange. We’re now updating this chart weekly (last update: September 25).

The data was pulled from baseball-reference.com. This plot uses the Economist theme.

Code is below . . .

library(tidyverse)
library(rvest)
library(ggthemes)
library(extrafont)

'https://www.baseball-reference.com/leagues/MLB/2020-standings.shtml' %>%
  read_html() %>%
  html_table() %>%
  bind_rows() %>%
  mutate(gp = W + L) %>%
  count(gp) %>%
  ggplot(aes(gp, n)) + 
  geom_bar(
    stat = 'identity',
    width = 0.8, 
    alpha = 0.8
    ) + 
    theme_economist() + 
    scale_x_continuous(breaks=seq(0,40,5)) +
    scale_y_continuous(breaks=seq(0,10,1)) +
    labs(x="Games Played", y="Number of Teams", 
    title = "MLB: Number of Games Played by Team Through August 29, 2020",
    caption = "Data source: baseball-reference.com")