Reputation: 249
I am creating a heatmap for a given matrix. I also separately have multiple factors to be shown along with the heatmap. Right now I could create one RowSideColors for one factor. But is there a way to create RowSideColors for multiple factors from gplots heatmap.2 function? In other words, many RowSideColors with the heatmap. Any tips?
Upvotes: 1
Views: 1011
Reputation: 573
Based on what you've posted, I've attempted to include a reproducible example below in case anyone else has a similar question:
require(gplots)
data(mtcars)
df <- as.matrix(mtcars[,8:11])
df = df[order(rownames(df)),] # sorts the rows in alphabetical order
# specifying a column dendrogram
heatmap.2(df, Rowv=FALSE, dendrogram=c("column"))
The resulting heatmap is as follows:
Upvotes: 1
Reputation: 249
After bit of digging, I found the solution myself that if you specify
tmpSorted = tmp[order(rownames(tmp)),] # sorts alphabetical order
heatmap.2(tmpSorted, Rowv=F .... )
the option Rowv=F works!
Upvotes: 0