Produce Heatmap of NBA player perfomance 2008 season

nba <- read.csv("http://datasets.flowingdata.com/ppg2008.csv", sep=",")
nba <- nba[order(nba$PTS),]
row.names(nba) <- nba$Name
nba <- nba[,2:20]
nba_matrix <- data.matrix(nba)
nba_heatmap <- heatmap(nba_matrix, Rowv=NA, Colv=NA, col = cm.colors(256), scale="column", margins=c(5,10))

heat palette gives more distinct colors

nba_heatmap <- heatmap(nba_matrix, Rowv=NA, Colv=NA, col = heat.colors(256), scale="column", margins=c(5,10))

Not being into basketball, I can’t easily make head nor tails of the column names. It seems obscure how the rows are ordered.

Produce treemap of Flowing Data topic views and comments

where each topic is sized by the count of views and and colored by the count of comments. I don’t understand how the rows and columns are arranged. What is the unlabled rectangle? RColorBrewer provides a diverging color palette RdYlBu comprising a red, yellow, and blue spectrum.

data <- read.csv("http://datasets.flowingdata.com/post-data.txt")
head(data)
##     id  views comments               category
## 1 5019 148896       28 Artistic Visualization
## 2 1416  81374       26          Visualization
## 3 1416  81374       26               Featured
## 4 3485  80819       37               Featured
## 5 3485  80819       37                Mapping
## 6 3485  80819       37           Data Sources
##     id  views comments               category
## 1 5019 148896       28 Artistic Visualization
## 2 1416  81374       26          Visualization
## 3 1416  81374       26               Featured
## 4 3485  80819       37               Featured
## 5 3485  80819       37                Mapping
## 6 3485  80819       37           Data Sources
#install.packages("RColorBrewer")
#install.packages("treemap")
library(treemap)
library(RColorBrewer)
treemap(data, index="category", vSize="views",  
        vColor="comments", type="value", palette="RdYlBu")

Produce Streamgraph of generate demo data frame

columns of year, name, value to generate interactive html time series where each name/key is bound to a colored stream spreading out from the x-axis.

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(streamgraph)
## Registered S3 method overwritten by 'xts':
##   method     from
##   as.zoo.xts zoo
year=rep(seq(1990,2016), each=10)
name=rep(letters[1:10], 27)
value=sample( seq(0,1,0.0001),length(year))
data=data.frame(year,name,value)
streamgraph(data, key="name",value="value",date="year")