我正在使用heatmaps.plus来创建RowSideColors的热图。我唯一无法弄清楚的是如何为RowSideColors创建一个图例(例如,绿色是Group1而黑色是Group2)。非常感谢任何帮助,谢谢!
答案 0 :(得分: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)