library("heatmap.2x")
## Loading required package: gplots
## 
## Attaching package: 'gplots'
## The following object is masked from 'package:multtest':
## 
##     wapply
## The following object is masked from 'package:stats':
## 
##     lowess
## Loading required package: gtools
#heatmap with recommended settings
heatmap.2x(golub, scale="none", trace="none", col=bluered(50))

#create color bar
colbar <- c("lightblue", "palevioletred")[golub.cl+1]
heatmap.2x(golub, scale="none", trace="none", col=bluered(50), ColSideColors=colbar)

n<- 10
colbar <- rainbow(n)[rep(c(1:n),(ncol(golub)/n))]
heatmap.2x(golub, scale="none", trace="none", col=bluered(50), ColSideColors=colbar)

#These should behave just as heatmap.2
#create a row bar
rowbar <- c("red", "blue")[rep(c(1,2),(nrow(golub)/2))]
heatmap.2x(golub, scale="none", trace="none", col=bluered(50), RowSideColors=rowbar)

n<- 10
rowbar <- rainbow(n)[rep(c(1:n),(nrow(golub)/n))]
heatmap.2x(golub, scale="none", trace="none", col=bluered(50), RowSideColors=rowbar)

#These should behave just as heatmap.2
#create another color bar
colbars1 <- c("lightblue", "palevioletred")[golub.cl+1]
colbars2 <- c("yellow", "green", "cyan")
colbargolub <- rbind(colbars1, colbars2)
## Warning in .Method(..., deparse.level = deparse.level): number of columns
## of result is not a multiple of vector length (arg 2)
heatmap.2x(golub, scale="none", trace="none", col=bluered(50), ColSideColors=colbargolub)
## Warning in matrix(as.numeric(unlist(strsplit(paste("NA",
## 1:nrow(ColSideColors)), : NAs introduced by coercion

#create another color bar for rows
rowbars1 <- c("red", "blue")
rowbars2 <- c("yellow", "green", "cyan")[rep(1:3,(nrow(golub)/3))]
rowbargolub <- cbind(rowbars1, rowbars2)
## Warning in .Method(..., deparse.level = deparse.level): number of rows of
## result is not a multiple of vector length (arg 1)
heatmap.2x(golub, scale="none", trace="none", col=bluered(50), RowSideColors=rowbargolub)

heatmap.2x(golub, scale="none", trace="none", col=bluered(50), ColSideColors=colbargolub, RowSideColors=rowbargolub)
## Warning in matrix(as.numeric(unlist(strsplit(paste("NA",
## 1:nrow(ColSideColors)), : NAs introduced by coercion