I am using heatmaps.plus to create heatmaps with RowSideColors. The only thing I can't seem to figure out is how to make a legend for the RowSideColors (for example, green is Group1 and black is Group2). Any help would be greatly appreciated, thank you!
Asked
Active
Viewed 2,431 times
1
-
1Please provide us a reproducilbe-example (http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – sgibb Jun 25 '13 at 22:55
1 Answers
1
You should use legend
for this.
library("heatmap.plus")
#Create dummy data
data <- replicate(10, rnorm(10))
rsc <- c("green", "green", "black", "green", "green", "black", "black", "green", "green", "black")
rsc <- cbind(rsc, rsc)
colnames(rsc) <- c("Groups", "")
#Plot
heatmap.plus(data, RowSideCol = rsc)
#Legend on position (40, 2)
legend(40, 2,legend=c("Title","","Group1","Group2"), fill=c("white", "white", "green","black"), border=FALSE, bty="n", y.intersp = 0.7, cex=0.7)

Mehdi Nellen
- 8,486
- 4
- 33
- 48