drajaman at bidmc.harvard.edu
2009-Mar-17 02:08 UTC
[R] Adding labels to heatmaps from image()
Hi, I have been trying to add labels to the rows of a heatmap produced using image() function. It is simply not working. Here is what I did. A2Rplot.hclust(hcc,k=length(num),col.up="black",col.down=num,lty.up=2,lty.down=1,lwd.up=1,lwd.down=2,show.labels=FALSE) #used the above external program to create a colored dendrogram xsort <- x[1:nrow(x), hcc$labels[hcc$order]] go<-genes[hc$order] image(scale(t(xsort)), col=greenred(60),xaxt="n", yaxt="n") di <- dim(x) nr<-di[1] nc<-di[2] axis(4, 1:nr, labels=go, las= 2, line= 0, tick=TRUE, cex.axis= 2) The output pdf I get is attached in this mail. I just get the first member of the vector "go" on axis(4). It looks like the program does not know where or how long axis(4) should be. I have been stuck with this problem for the past couple of days, desperately need help. Thanks Deepa Rajamani -------------- next part -------------- A non-text attachment was scrubbed... Name: EHF,ERG,ELF2,ELF3.pdf Type: application/pdf Size: 54050 bytes Desc: EHF,ERG,ELF2,ELF3.pdf URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090316/6b56729d/attachment-0003.pdf>
drajaman at bidmc.harvard.edu wrote:> Hi, > > I have been trying to add labels to the rows of a heatmap produced using image() function. It is simply not working. Here is what I did. > > A2Rplot.hclust(hcc,k=length(num),col.up="black",col.down=num,lty.up=2,lty.down=1,lwd.up=1,lwd.down=2,show.labels=FALSE) > #used the above external program to create a colored dendrogram > xsort <- x[1:nrow(x), hcc$labels[hcc$order]] > go<-genes[hc$order] > image(scale(t(xsort)), col=greenred(60),xaxt="n", yaxt="n") > di <- dim(x) > nr<-di[1] > nc<-di[2] > axis(4, 1:nr, labels=go, las= 2, line= 0, tick=TRUE, cex.axis= 2) > > The output pdf I get is attached in this mail. I just get the first member of the vector "go" on axis(4). It looks like the program does not know where or how long axis(4) should be. > > I have been stuck with this problem for the past couple of days, desperately need help.Where is the reproducible example the posting guide asks you to provide? Uwe Ligges> Thanks > Deepa Rajamani > > > ------------------------------------------------------------------------ > > This body part will be downloaded on demand.