2

I have gone through the documentation of the heatmap.2() function in the gplots package in R looking for a way to code a color key for the ColSideColors argument. Is this supported? I would like to show which levels are represented by each color on the output plot.

4

1 回答 1

0

legendR中的函数可以帮助解决这个问题。

代码看起来像这样:

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.

您可以在本教程中获得帮助

于 2018-01-16T14:43:20.347 回答