Help with creating a figure
1
0
Entering edit mode
@steve-lianoglou-2771
Last seen 21 months ago
United States
Hi, I'm trying to recreate a figure from a publication[1] that looks like this: http://cbio.mskcc.org/~lianos/images/barfig.png I have some vectors with "scores" (that you see is plotted horizontally there) that I'd just like to turn into some colored representation/heatmap like that. I'd also like to then display the legend of the heatmap on the right there. It would be great if we can add the labels too, but if it's overkill to do, then I'll deal without them. I have code that is my crude attempt at plotting on of those bars, but I think I'm going about it the wrong way. I'm also at a loss at finding the magic incantation is to get the colorbar up on the side (the equivalent to MATLAB's `colorbar` call[2], I guess). nboxes <-length(scores) cp <- colorRampPalette(c('darkblue', 'darkred'))(30) plot(1, 1, xlim=c(0, 50), ylim=c(-1,1), type="n", axes=FALSE, bty="n", xlab=names(scores), ylab="") rect(xlef=0:nboxes, ybottom=1, xright=(0:nboxes)+1, ytop=1.8, col=cp[1:nboxes], border='light grey') I looked trough the R graphics gallery[3] to see if I could find something similar, but I'm not finding anything that's helping ... Some code examples would be great, but some general pointers to places I should be looking into would also be a big help. Thanks, -steve [1] Bild et al. Oncogenic pathway signatures in human cancers as a guide to targeted, Nature 2006. [2] http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/ access/helpdesk/help/techdoc/ref/colorbar.html [3] http://addictedtor.free.fr/graphiques/ -- Steve Lianoglou Graduate Student: Physiology, Biophysics, and Systems Biology Weill Medical College, Cornell University http://cbio.mskcc.org/~lianos
Biophysics Biophysics • 994 views
ADD COMMENT
0
Entering edit mode
Artur Veloso ▴ 340
@artur-veloso-2062
Last seen 10.2 years ago
Hi Steve, I don't know if there is a function that makes a figure like that, but with a little bit of work you should be able to plot a figure extremely similar to the one you showed. I couldn't see what your example looked like because you didn't define the object scores, but I created a little example that looks a little bit like what you want it to look like. I hope this helps. Cheers, Artur Veloso Master's Candidate College of Charleston Charleston, SC cp <- colorRampPalette(c('darkblue', 'darkred'))(30) layout(matrix(c(1,2,3,4,4,0),ncol=2),widths=c(0.8,0.2)) par(mar=c(5, 6, 4, 2) + 0.1) #creates the top image image(x=seq(0,1,0.1),z=matrix(rnorm(10)),xaxt="n",yaxt="n",bty="n",xla b="",col=cp) axis(side=3,at=seq(0,0.9,0.1)+.05,labels=paste("gene",1:10),las=2,tick ="F") axis(side=2,at=0,labels="Condition 1",las=2,tick=F) #creates the middle image image(x=seq(0,1,0.1),z=matrix(rnorm(10)),xaxt="n",yaxt="n",bty="n",xla b="",col=cp) axis(side=3,at=seq(0,0.9,0.1)+.05,labels=paste("gene",1:10),las=2,tick ="F") axis(side=2,at=0,labels="Condition 2",las=2,tick=F) #creates the bottom image image(x=seq(0,1,0.1),z=matrix(rnorm(10)),xaxt="n",yaxt="n",bty="n",xla b="",col=cp) axis(side=3,at=seq(0,0.9,0.1)+.05,labels=paste("gene",1:10),las=2,tick ="F") axis(side=2,at=0,labels="Condition 3",las=2,tick=F) #creates the side bar par(mar=c(5, 2, 4, 3) + 0.1) image(y=1:10,z=matrix(1:10,ncol=10),xaxt="n",yaxt="n",bty="n",ylab="", col=cp) axis(side=4,at=1:10,labels=1:10,las=2,tick=F) On Tue, Jun 17, 2008 at 3:09 PM, Steve Lianoglou < mailinglist.honeypot@gmail.com> wrote: > Hi, > > I'm trying to recreate a figure from a publication[1] that looks like this: > http://cbio.mskcc.org/~lianos/images/barfig.png<http: cbio.mskcc.or="" g="" %7elianos="" images="" barfig.png=""> > > I have some vectors with "scores" (that you see is plotted horizontally > there) that I'd just like to turn into some colored representation/heatmap > like that. I'd also like to then display the legend of the heatmap on the > right there. It would be great if we can add the labels too, but if it's > overkill to do, then I'll deal without them. > > I have code that is my crude attempt at plotting on of those bars, but I > think I'm going about it the wrong way. I'm also at a loss at finding the > magic incantation is to get the colorbar up on the side (the equivalent to > MATLAB's `colorbar` call[2], I guess). > > nboxes <-length(scores) > cp <- colorRampPalette(c('darkblue', 'darkred'))(30) > plot(1, 1, xlim=c(0, 50), ylim=c(-1,1), type="n", axes=FALSE, bty="n", > xlab=names(scores), ylab="") > rect(xlef=0:nboxes, ybottom=1, xright=(0:nboxes)+1, ytop=1.8, > col=cp[1:nboxes], border='light grey') > > I looked trough the R graphics gallery[3] to see if I could find something > similar, but I'm not finding anything that's helping ... > > Some code examples would be great, but some general pointers to places I > should be looking into would also be a big help. > > Thanks, > -steve > > [1] Bild et al. Oncogenic pathway signatures in human cancers as a guide to > targeted, Nature 2006. > [2] > http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/ac cess/helpdesk/help/techdoc/ref/colorbar.html > [3] http://addictedtor.free.fr/graphiques/ > > -- > Steve Lianoglou > Graduate Student: Physiology, Biophysics, and Systems Biology > Weill Medical College, Cornell University > > http://cbio.mskcc.org/~lianos <http: cbio.mskcc.org="" %7elianos=""> > > _______________________________________________ > Bioconductor mailing list > Bioconductor@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > [[alternative HTML version deleted]]
ADD COMMENT

Login before adding your answer.

Traffic: 846 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6