Add VT2-examples: all 6 chapters of 'Visualize This' (110 files) — data scraping, ETL, trends, categorical, multivariate, spatial, distribution analysis
This commit is contained in:
1 parent
088771a9cf
commit
b42b866a8c
110 files changed
+400895
No files matched your search
@@ -0,0 +1,40 @@
|
||||
# install.packages("MASS")
|
||||
library(MASS)
|
||||
|
||||
|
||||
#
|
||||
# Load data
|
||||
#
|
||||
|
||||
players <- read.csv("data/nba-top50scorers-2022-23.csv")
|
||||
head(players)
|
||||
|
||||
|
||||
#
|
||||
# Parallel coordinates
|
||||
#
|
||||
|
||||
fnames <- c("MP", "FG", "FGpct", "X2Ppct", "X3Ppct", "FTpct", "PTS")
|
||||
psub <- players[,fnames]
|
||||
|
||||
# Parallel coordinates
|
||||
parcoord(psub)
|
||||
|
||||
# Pick out player
|
||||
curr_players <- c("Joel Embiid", "Giannis Antetokounmpo",
|
||||
"Stephen Curry", "LeBron James")
|
||||
par(mfrow=c(2,2))
|
||||
for (pl in curr_players) {
|
||||
col <- rep("gray", dim(players)[1])
|
||||
lwd <- rep(.5, dim(players)[1])
|
||||
i <- which(players$Player == pl)
|
||||
col[i] <- "blue"
|
||||
lwd[i] <- 3
|
||||
parcoord(psub, col=col, lwd=lwd, main=pl)
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Scatterplot Matrix
|
||||
par(las=1)
|
||||
plot(psub)
|
||||
Reference in new issue
Block a user