Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# load packages - install from CRAN if you don't have the package:
# install.packages("waffle")
library(waffle)
# all data taken from
# basketball-reference.com - keep up the great work!
dubs <- c("X3p" = 251,"X2p" = 552 ,"FT" = 333)
dubs_points_scored <- dubs * c(3,2,1)
names(dubs_points_scored) <- c("by 3s","by 2s","by FTs")
# use cavs as benchmark
cavs <- c(183,495,298)
cavs_points_scored <- cavs*c(3,2,1)
names(cavs_points_scored) <- c("by 3s","by 2s","by FTs")
# a waffle chart for the dubs
gsw <- waffle(dubs_points_scored,
rows=40,
size=.5,
colors=c("#003CC3",
"#FFE500",
"#DCDDDC"))
# a waffle chart for cavs
cle <- waffle(cavs_points_scored,
rows=40,
size=.5,
colors=c("#9A0041",
"#003578",
"#FED042"),
pad=9
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.