I would like to be able to have use two RowSideColor bars with the heatmap.2 function from the R package plots, but I can't figure out how to do it. I've seen this question asked before on stack overflow, and while the question was responded to, the responses didn't address the question. Adding the factors to the input data matrix won't work because it would affect the results of the hierarchical clustering. I am open to using other heatmap-like functions to achieve my goals if that's necessary.
Thanks, Brad
I've wanted to do this before and always used to make two heatmaps and copy and paste one RowSideColors
bar from one heatmap onto the other one. I just did some more searching and found the heatmap.plus
package that can do this, though:
# install.packages("heatmap.plus") #install package
require("heatmap.plus")
data(cars) # using cars data as example
# create a matrix of colors for RowSideColors
myCols = cbind(rep(c("yellow", "blue"), 25), rep(c("red", "green"), 25))
heatmap.plus(data.matrix(cars), RowSideColors=myCols)
The RowSideColors
argument in this package can accept a matrix of colors to plot multiple row side colors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With