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,42 @@
|
||||
|
||||
#
|
||||
# Load data
|
||||
#
|
||||
|
||||
players <- read.csv("data/nba-top50scorers-2022-23.csv")
|
||||
head(players)
|
||||
|
||||
play20 <- players[1:20,]
|
||||
|
||||
#
|
||||
# Heatmap
|
||||
#
|
||||
|
||||
# Four columns
|
||||
heatmap(as.matrix(play20[,c("MP", "FG", "FGpct", "PTS")]),
|
||||
scale = "column",
|
||||
Rowv = NA, Colv = NA)
|
||||
|
||||
# Names
|
||||
heatmap(as.matrix(play20[,c("MP", "FG", "FGpct", "PTS")]),
|
||||
scale = "column",
|
||||
labRow = play20$Player,
|
||||
Rowv = NA, Colv = NA)
|
||||
|
||||
# Change order
|
||||
playrev <- play20[order(play20$PTS, decreasing = FALSE),]
|
||||
heatmap(as.matrix(playrev[,c("MP", "FG", "FGpct", "PTS")]),
|
||||
scale = "column",
|
||||
labRow = playrev$Player,
|
||||
Rowv = NA, Colv = NA)
|
||||
|
||||
|
||||
# Color
|
||||
playrev <- play20[order(play20$PTS, decreasing = FALSE),]
|
||||
heatmap(as.matrix(playrev[,c("MP", "FG", "FGpct", "X2Ppct", "X3Ppct", "FTpct", "PTS")]),
|
||||
scale = "column",
|
||||
labRow = playrev$Player,
|
||||
cexCol = 1,
|
||||
col = rev(hcl.colors(20, palette = "Blues 3")),
|
||||
Rowv = NA, Colv = NA)
|
||||
|
||||
Reference in new issue
Block a user