2

我正在尝试使用以下代码进行无偏见的分层聚类

col.cell <- c("purple","orange", "green", "blue")[sampleinf$subtype]
heatmap.2(as.matrix(hm3),col=rev(morecols(50)),trace="none", main="Top 500 most variable genes across samples",ColSideColors=col.cell,scale="row")  
    legend("topright",      
    legend = unique(sampleinf$subtype),
    col = col.cell,     
    lty= 1.5,   lwd = 2,           
    cex=.6)

我怎样才能使颜色图例更明显。现在它与树状图叠加。

在此处输入图像描述

4

1 回答 1

1

要在 0 到 1 的范围之外绘图,您需要使用 par(xpd=TRUE)

 legend(x = #,y= #, xpd = TRUE, legend("topright",      
    legend = unique(sampleinf$subtype),
    col = col.cell,     
    lty= 1.5,   lwd = 2,           
    cex=.6)
于 2017-05-24T12:16:04.157 回答