Skip to content

ariespirgel/ggnba

Repository files navigation

ggplot2 nba themes, scales, and geoms

This package contains ggplot2 themes, scales, and geoms, for all 30 NBA teams. All of the code included in this package was taken directly from Ricardo Bion's ggtech package and modified for use with NBA team colors and logos.

Install ggnba:

devtools::install_github("spirgel/ggnba", 
                          dependencies=TRUE)

Use ggnba

library(ggnba)
library(tidyverse)

d <- diamonds %>% 
  filter(color == "G" | color == "H" |
           color == "I" | color == "J") %>% 
  ggplot(aes(x = carat, fill = color)) +
  geom_histogram(color = "black")
d + theme_nba("heat") +
  scale_fill_nba("heat") +
  labs(title = "Miami Heat theme")

d + theme_nba("grizzlies") +
  scale_fill_nba("grizzlies") +
  labs(title = "Memphis Grizzlies theme")

d + theme_nba("kings") +
  scale_fill_nba("kings") +
  labs(title = "Sacramento Kings theme")

As mentioned, the code for this package was modified from Ricardo Bion's ggtech package. His geom_tech was inspired by emoGG, thus, so is geom_nba.

d2 <- data.frame(x = c(1:4, 3:1), y=1:7)
ggplot(d2, aes(x = x, y = y)) + 
  geom_nba(size=0.25, theme = "heat") + 
  theme_nba("heat") +
  ggtitle("Miami Heat geom")

ggplot(d2, aes(x = x, y = y)) + 
  geom_nba(size=0.25, theme = "grizzlies") + 
  theme_nba("grizzlies") +
  ggtitle("Memphis Grizzlies geom")

ggplot(d2, aes(x = x, y = y)) + 
  geom_nba(size=0.25, theme = "kings") + 
  theme_nba("kings") +
  ggtitle("Sacramento Kings geom")

About

ggplot2 nba themes, scales, and geoms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages