ColSideColors是heatmap.2函数R的关键

时间:2017-08-21 22:13:07

标签: r gplots

我已经浏览了R中heatmap.2()包中的gplots函数的文档,寻找为ColSideColors参数编码颜色键的方法。这支持吗?我想在输出图上显示每种颜色代表哪些级别。

1 个答案:

答案 0 :(得分:0)

R中的

legend函数可以帮助解决这个问题。

代码看起来像这样:

heatmap.2(mydata,ColSideColors=mycolors)
# ploting a heatmap
legend("left", title = "Tissues",legend=c("group1","group2"), 
       fill=c("red","green"), cex=0.8, box.lty=0)
# add a legend in which put your group text in legend, 
# and pass your colors which is used in heatmap.2 to fill.

您可以在此tutorial

中获得帮助