I am trying to do an unbiased Hierarchical clustering with the following code
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)
How can i make the color legend more visible. Now its superimposing with the dendrogram.
To plot outside the range of 0 to 1, you need to use par(xpd=TRUE)
legend(x = #,y= #, xpd = TRUE, legend("topright",
legend = unique(sampleinf$subtype),
col = col.cell,
lty= 1.5, lwd = 2,
cex=.6)