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

#create color bar
colbar <- c("red", "blue")[rep(c(1,2),(ncol(mat)/2))]
heatmap.2x(mat, scale="none", trace="none", col=bluered(50), ColSideColors=colbar)

n<- 10
colbar <- rainbow(n)[rep(c(1:n),(ncol(mat)/n))]
heatmap.2x(mat, 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(mat)/2))]
heatmap.2x(mat, scale="none", trace="none", col=bluered(50), RowSideColors=rowbar)

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

#These should behave just as heatmap.2
#create another color bar
colbars1 <- c("red", "blue")[rep(c(1,2),(ncol(mat)/2))]
colbars2 <- c("yellow", "green", "cyan")
colbarmat <- rbind(colbars1, colbars2)
## Warning in rbind(colbars1, colbars2): number of columns of result is not a
## multiple of vector length (arg 2)
heatmap.2x(mat, scale="none", trace="none", col=bluered(50), ColSideColors=colbarmat)
## 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")[rep(c(1,2),(nrow(mat)/2))]
rowbars2 <- c("yellow", "green", "cyan")
rowbarmat <- cbind(rowbars1, rowbars2)
## Warning in cbind(rowbars1, rowbars2): number of rows of result is not a
## multiple of vector length (arg 2)
heatmap.2x(mat, scale="none", trace="none", col=bluered(50), RowSideColors=rowbarmat)

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