1

我正在使用 heatmaps.plus 创建带有 RowSideColors 的热图。我似乎唯一想不通的是如何为 RowSideColors 制作图例(例如,绿色是 Group1,黑色是 Group2)。任何帮助将不胜感激,谢谢!

4

1 回答 1

1

你应该使用legend这个。

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)
于 2013-07-19T11:56:35.803 回答