简体   繁体   中英

Multiple RowSideColor columns heatmap.2 from gplots package

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM