OT: question about plots, general R, really...
1
0
Entering edit mode
@jdelasherasedacuk-1189
Last seen 8.7 years ago
United Kingdom
This is a bit off-topic, as it's purely R, I suppose... I am making figures containing 6 plots (MA plots, in this case), using: par(mfrow=c(2,3)) now, I would like to add a title, for instance, to the whole figure, not to the individual plots... how does one do that? I can only seem to add text, title etc to each plot... thanks for any pointers! Jose -- Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 Swann Building, Mayfield Road University of Edinburgh Edinburgh EH9 3JR UK
• 1.4k views
ADD COMMENT
0
Entering edit mode
Ana Conesa ▴ 140
@ana-conesa-925
Last seen 9.6 years ago
Hi Jose, I came across this same problem some time ago and I figured out a quite rudimentary solution, I guess. Probably there are more elgant ones (I would love to know them!!!) Basically what I do is: - Split my device up into one more row, very narrow, at the upper part, to host the general title, and then set my first figure to spand across this first row. - Then plot a "ghost" plot in which I have made everything not visible but the Title. Normally you have to adjust the margins for this first "plot" in advance. - Resest the margins - Plot the other plots For example, for a title, plus 4 figures you could use: > layout(matrix(c(1,1,2,3,4,5),3,2, byrow=T),heights=c(1,6,6)) > par(mar=c(0.1,0.1,2,0.1)) > plot(0, main="Your Title", xaxt="n", yaxt="n", xlab="", ylab="",bty="n",col="white") >par(mar=c(c(4, 4, 4, 2))) > plot...what ever... You have to play a bit with the heights parameter of layout to get the division you are happy with (the function layout.show() shows you the position of each plot in your screen). And play also with the margins, maybe. Hope this is of some use to you... Ana On Tue, 04 Jul 2006 18:12:56 +0100, J.delasHeras wrote > This is a bit off-topic, as it's purely R, I suppose... > > I am making figures containing 6 plots (MA plots, in this case), using: > > par(mfrow=c(2,3)) > > now, I would like to add a title, for instance, to the whole figure, > not to the individual plots... how does one do that? I can only seem > to add text, title etc to each plot... > > thanks for any pointers! > > Jose > > -- > Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk > The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 > Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 > Swann Building, Mayfield Road > University of Edinburgh > Edinburgh EH9 3JR > UK > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- IVIA (http://www.ivia.es) Open WebMail Project (http://openwebmail.org) Debian Project (http://www.debian.org)
ADD COMMENT
0
Entering edit mode
You might also consider using the 'xpd' argument to par(). > par(xpd = NA) > plot(1:10) > plot(1:10) > plot(1:10) > plot(1:10) > plot(1:10) > plot(1:10) > text(-12,28,"A header string") The only problem with this solution is finding where to put things. An alternative is to use > text(locator(1), "A header string") and then place it where you want. HTH, Jim Ana Conesa wrote: > Hi Jose, > > I came across this same problem some time ago and I figured out a quite > rudimentary solution, I guess. Probably there are more elgant ones (I would > love to know them!!!) > Basically what I do is: > - Split my device up into one more row, very narrow, at the upper part, to > host the general title, and then set my first figure to spand across this > first row. > - Then plot a "ghost" plot in which I have made everything not visible but > the Title. Normally you have to adjust the margins for this first "plot" in > advance. > - Resest the margins > - Plot the other plots > > For example, for a title, plus 4 figures you could use: > >>layout(matrix(c(1,1,2,3,4,5),3,2, byrow=T),heights=c(1,6,6)) >>par(mar=c(0.1,0.1,2,0.1)) >>plot(0, main="Your Title", xaxt="n", yaxt="n", xlab="", > > ylab="",bty="n",col="white") > >>par(mar=c(c(4, 4, 4, 2))) >>plot...what ever... > > > You have to play a bit with the heights parameter of layout to get the > division you are happy with (the function layout.show() shows you the > position of each plot in your screen). And play also with the margins, maybe. > > Hope this is of some use to you... > > Ana > > > On Tue, 04 Jul 2006 18:12:56 +0100, J.delasHeras wrote > >>This is a bit off-topic, as it's purely R, I suppose... >> >>I am making figures containing 6 plots (MA plots, in this case), using: >> >>par(mfrow=c(2,3)) >> >>now, I would like to add a title, for instance, to the whole figure, >>not to the individual plots... how does one do that? I can only seem >>to add text, title etc to each plot... >> >>thanks for any pointers! >> >>Jose >> >>-- >>Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk >>The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 >>Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 >>Swann Building, Mayfield Road >>University of Edinburgh >>Edinburgh EH9 3JR >>UK >> >>_______________________________________________ >>Bioconductor mailing list >>Bioconductor at stat.math.ethz.ch >>https://stat.ethz.ch/mailman/listinfo/bioconductor >>Search the archives: > > http://news.gmane.org/gmane.science.biology.informatics.conductor > > > -- > IVIA (http://www.ivia.es) > Open WebMail Project (http://openwebmail.org) > Debian Project (http://www.debian.org) > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- James W. MacDonald University of Michigan Affymetrix and cDNA Microarray Core 1500 E Medical Center Drive Ann Arbor MI 48109 734-647-5623 ********************************************************** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.
ADD REPLY
0
Entering edit mode
I can't remember syntax exactly, but using the omi argument to par to set the top outer margin and then mtext, to set some margin text, works very well something like par(omi=c(0,0,0.1,0)) # omi is for inches, oma (usage oma=c(0,0,3,0)) is for lines mtext(label="Something") Maybe this link will help you: http://www.stat.auckland.ac.nz/~paul/Talks/Rgraphics.pdf I have a working solution on my home computer I can share if needed Ulrik On 7/4/06, James W. MacDonald <jmacdon at="" med.umich.edu=""> wrote: > You might also consider using the 'xpd' argument to par(). > > > par(xpd = NA) > > plot(1:10) > > plot(1:10) > > plot(1:10) > > plot(1:10) > > plot(1:10) > > plot(1:10) > > text(-12,28,"A header string") > > The only problem with this solution is finding where to put things. An > alternative is to use > > > text(locator(1), "A header string") and then place it where you want. > > HTH, > > Jim > > > Ana Conesa wrote: > > Hi Jose, > > > > I came across this same problem some time ago and I figured out a quite > > rudimentary solution, I guess. Probably there are more elgant ones (I would > > love to know them!!!) > > Basically what I do is: > > - Split my device up into one more row, very narrow, at the upper part, to > > host the general title, and then set my first figure to spand across this > > first row. > > - Then plot a "ghost" plot in which I have made everything not visible but > > the Title. Normally you have to adjust the margins for this first "plot" in > > advance. > > - Resest the margins > > - Plot the other plots > > > > For example, for a title, plus 4 figures you could use: > > > >>layout(matrix(c(1,1,2,3,4,5),3,2, byrow=T),heights=c(1,6,6)) > >>par(mar=c(0.1,0.1,2,0.1)) > >>plot(0, main="Your Title", xaxt="n", yaxt="n", xlab="", > > > > ylab="",bty="n",col="white") > > > >>par(mar=c(c(4, 4, 4, 2))) > >>plot...what ever... > > > > > > You have to play a bit with the heights parameter of layout to get the > > division you are happy with (the function layout.show() shows you the > > position of each plot in your screen). And play also with the margins, maybe. > > > > Hope this is of some use to you... > > > > Ana > > > > > > On Tue, 04 Jul 2006 18:12:56 +0100, J.delasHeras wrote > > > >>This is a bit off-topic, as it's purely R, I suppose... > >> > >>I am making figures containing 6 plots (MA plots, in this case), using: > >> > >>par(mfrow=c(2,3)) > >> > >>now, I would like to add a title, for instance, to the whole figure, > >>not to the individual plots... how does one do that? I can only seem > >>to add text, title etc to each plot... > >> > >>thanks for any pointers! > >> > >>Jose > >> > >>-- > >>Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk > >>The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 > >>Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 > >>Swann Building, Mayfield Road > >>University of Edinburgh > >>Edinburgh EH9 3JR > >>UK > >> > >>_______________________________________________ > >>Bioconductor mailing list > >>Bioconductor at stat.math.ethz.ch > >>https://stat.ethz.ch/mailman/listinfo/bioconductor > >>Search the archives: > > > > http://news.gmane.org/gmane.science.biology.informatics.conductor > > > > > > -- > > IVIA (http://www.ivia.es) > > Open WebMail Project (http://openwebmail.org) > > Debian Project (http://www.debian.org) > > > > _______________________________________________ > > Bioconductor mailing list > > Bioconductor at stat.math.ethz.ch > > https://stat.ethz.ch/mailman/listinfo/bioconductor > > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > > > -- > James W. MacDonald > University of Michigan > Affymetrix and cDNA Microarray Core > 1500 E Medical Center Drive > Ann Arbor MI 48109 > 734-647-5623 > > > > ********************************************************** > Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues. > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Blog: http://ulrikstervbo.blogspot.com Mailing-list: http://www.coollist.com/group.cgi?l=ulrik_i_berlin
ADD REPLY
0
Entering edit mode
Hi Ulrik, thanks for your reply. I haven't managed to make it work the way you describe, unfortunately. It seems to affect only the last plot, not the whole figure... I guess I need to investigate this further. If you can send me the example that worked for you I'd appreciate that, as it may help me find out why it doesn't work for me. The link about Rgraphics is quite good, thanks for that! Just for teh record, this is one example of the plots I would like to add text to: par(mfrow=c(2,3)) for (i in 1:3) { plot(log2(RG$Rb[,i]),log2(RG$R[,i]),pch=".") abline(0,1,col="blue")} for (i in 1:3) { plot(log2(RG$Gb[,i]),log2(RG$G[,i]),pch=".") abline(0,1,col="blue")} so that gives me 6 plots in the same figure. I want to be able to add a title to the whole figure... or maybe add other text here and there... using the whole figure, not the individual plots. Thanks for your help! Jose Quoting Ulrik Stervbo <ulriks at="" ruc.dk="">: > I can't remember syntax exactly, but using the omi argument to par to > set the top outer margin and then mtext, to set some margin text, > works very well > > something like > par(omi=c(0,0,0.1,0)) # omi is for inches, oma (usage oma=c(0,0,3,0)) > is for lines > mtext(label="Something") > > Maybe this link will help you: > http://www.stat.auckland.ac.nz/~paul/Talks/Rgraphics.pdf > > I have a working solution on my home computer I can share if needed > > Ulrik > > On 7/4/06, James W. MacDonald <jmacdon at="" med.umich.edu=""> wrote: >> You might also consider using the 'xpd' argument to par(). >> >> > par(xpd = NA) >> > plot(1:10) >> > plot(1:10) >> > plot(1:10) >> > plot(1:10) >> > plot(1:10) >> > plot(1:10) >> > text(-12,28,"A header string") >> >> The only problem with this solution is finding where to put things. An >> alternative is to use >> >> > text(locator(1), "A header string") and then place it where you want. >> >> HTH, >> >> Jim >> >> >> Ana Conesa wrote: >> > Hi Jose, >> > >> > I came across this same problem some time ago and I figured out a quite >> > rudimentary solution, I guess. Probably there are more elgant ones >> (I would >> > love to know them!!!) >> > Basically what I do is: >> > - Split my device up into one more row, very narrow, at the upper part, to >> > host the general title, and then set my first figure to spand across this >> > first row. >> > - Then plot a "ghost" plot in which I have made everything not visible but >> > the Title. Normally you have to adjust the margins for this first >> "plot" in >> > advance. >> > - Resest the margins >> > - Plot the other plots >> > >> > For example, for a title, plus 4 figures you could use: >> > >> >>layout(matrix(c(1,1,2,3,4,5),3,2, byrow=T),heights=c(1,6,6)) >> >>par(mar=c(0.1,0.1,2,0.1)) >> >>plot(0, main="Your Title", xaxt="n", yaxt="n", xlab="", >> > >> > ylab="",bty="n",col="white") >> > >> >>par(mar=c(c(4, 4, 4, 2))) >> >>plot...what ever... >> > >> > >> > You have to play a bit with the heights parameter of layout to get the >> > division you are happy with (the function layout.show() shows you the >> > position of each plot in your screen). And play also with the >> margins, maybe. >> > >> > Hope this is of some use to you... >> > >> > Ana >> > >> > >> > On Tue, 04 Jul 2006 18:12:56 +0100, J.delasHeras wrote >> > >> >>This is a bit off-topic, as it's purely R, I suppose... >> >> >> >>I am making figures containing 6 plots (MA plots, in this case), using: >> >> >> >>par(mfrow=c(2,3)) >> >> >> >>now, I would like to add a title, for instance, to the whole figure, >> >>not to the individual plots... how does one do that? I can only seem >> >>to add text, title etc to each plot... >> >> >> >>thanks for any pointers! >> >> >> >>Jose >> >> >> >>-- >> >>Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk >> >>The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 >> >>Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 >> >>Swann Building, Mayfield Road >> >>University of Edinburgh >> >>Edinburgh EH9 3JR >> >>UK >> >> >> >>_______________________________________________ >> >>Bioconductor mailing list >> >>Bioconductor at stat.math.ethz.ch >> >>https://stat.ethz.ch/mailman/listinfo/bioconductor >> >>Search the archives: >> > >> > http://news.gmane.org/gmane.science.biology.informatics.conductor >> > >> > >> > -- >> > IVIA (http://www.ivia.es) >> > Open WebMail Project (http://openwebmail.org) >> > Debian Project (http://www.debian.org) >> > >> > _______________________________________________ >> > Bioconductor mailing list >> > Bioconductor at stat.math.ethz.ch >> > https://stat.ethz.ch/mailman/listinfo/bioconductor >> > Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> >> >> -- >> James W. MacDonald >> University of Michigan >> Affymetrix and cDNA Microarray Core >> 1500 E Medical Center Drive >> Ann Arbor MI 48109 >> 734-647-5623 >> >> >> >> ********************************************************** >> Electronic Mail is not secure, may not be read every day, and should >> not be used for urgent or sensitive issues. >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> > > > -- > Blog: http://ulrikstervbo.blogspot.com > Mailing-list: http://www.coollist.com/group.cgi?l=ulrik_i_berlin > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 Swann Building, Mayfield Road University of Edinburgh Edinburgh EH9 3JR UK
ADD REPLY
0
Entering edit mode
An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/bioconductor/attachments/20060705/ 4583fa17/attachment.pl
ADD REPLY
0
Entering edit mode
Thanks Ulrik, and everyone else... it turns out I was forgetting to specify "outer=TRUE" on 'mtext' doh! It works perfectly now :-) Jose Quoting Ulrik Stervbo <ulriks at="" ruc.dk="">: > This should work... > > # save defaults for resetting > def.par <- par(no.readonly = TRUE) > # Set the layout > par(mfrow=c(2,3)) > # Set the size of the outer margin > par(oma=c(0,0,2,0)) > # Add a title to the top of the outer margin, using a bolf-face font > # Margin text is by default set to the side 3, which is the top, 1 = bottom, > 2 = left, 4 = right > mtext("A nice title", outer = TRUE, font=2) > # do all the plotting > # > # reset to default par > par(def.par) > > On 7/5/06, J.delasHeras at ed.ac.uk <j.delasheras at="" ed.ac.uk=""> wrote: >> >> >> Hi Ulrik, >> >> thanks for your reply. >> >> I haven't managed to make it work the way you describe, unfortunately. >> It seems to affect only the last plot, not the whole figure... I guess >> I need to investigate this further. If you can send me the example that >> worked for you I'd appreciate that, as it may help me find out why it >> doesn't work for me. >> The link about Rgraphics is quite good, thanks for that! >> >> Just for teh record, this is one example of the plots I would like to >> add text to: >> >> par(mfrow=c(2,3)) >> for (i in 1:3) { >> plot(log2(RG$Rb[,i]),log2(RG$R[,i]),pch=".") >> abline(0,1,col="blue")} >> for (i in 1:3) { >> plot(log2(RG$Gb[,i]),log2(RG$G[,i]),pch=".") >> abline(0,1,col="blue")} >> >> so that gives me 6 plots in the same figure. I want to be able to add a >> title to the whole figure... or maybe add other text here and there... >> using the whole figure, not the individual plots. >> >> Thanks for your help! >> >> Jose >> >> >> >> Quoting Ulrik Stervbo <ulriks at="" ruc.dk="">: >> >> > I can't remember syntax exactly, but using the omi argument to par to >> > set the top outer margin and then mtext, to set some margin text, >> > works very well >> > >> > something like >> > par(omi=c(0,0,0.1,0)) # omi is for inches, oma (usage oma=c(0,0,3,0)) >> > is for lines >> > mtext(label="Something") >> > >> > Maybe this link will help you: >> > http://www.stat.auckland.ac.nz/~paul/Talks/Rgraphics.pdf >> > >> > I have a working solution on my home computer I can share if needed >> > >> > Ulrik >> > >> > On 7/4/06, James W. MacDonald <jmacdon at="" med.umich.edu=""> wrote: >> >> You might also consider using the 'xpd' argument to par(). >> >> >> >> > par(xpd = NA) >> >> > plot(1:10) >> >> > plot(1:10) >> >> > plot(1:10) >> >> > plot(1:10) >> >> > plot(1:10) >> >> > plot(1:10) >> >> > text(-12,28,"A header string") >> >> >> >> The only problem with this solution is finding where to put things. An >> >> alternative is to use >> >> >> >> > text(locator(1), "A header string") and then place it where you >> want. >> >> >> >> HTH, >> >> >> >> Jim >> >> >> >> >> >> Ana Conesa wrote: >> >> > Hi Jose, >> >> > >> >> > I came across this same problem some time ago and I figured out a >> quite >> >> > rudimentary solution, I guess. Probably there are more elgant ones >> >> (I would >> >> > love to know them!!!) >> >> > Basically what I do is: >> >> > - Split my device up into one more row, very narrow, at the upper >> part, to >> >> > host the general title, and then set my first figure to spand across >> this >> >> > first row. >> >> > - Then plot a "ghost" plot in which I have made everything not >> visible but >> >> > the Title. Normally you have to adjust the margins for this first >> >> "plot" in >> >> > advance. >> >> > - Resest the margins >> >> > - Plot the other plots >> >> > >> >> > For example, for a title, plus 4 figures you could use: >> >> > >> >> >>layout(matrix(c(1,1,2,3,4,5),3,2, byrow=T),heights=c(1,6,6)) >> >> >>par(mar=c(0.1,0.1,2,0.1)) >> >> >>plot(0, main="Your Title", xaxt="n", yaxt="n", xlab="", >> >> > >> >> > ylab="",bty="n",col="white") >> >> > >> >> >>par(mar=c(c(4, 4, 4, 2))) >> >> >>plot...what ever... >> >> > >> >> > >> >> > You have to play a bit with the heights parameter of layout to get >> the >> >> > division you are happy with (the function layout.show() shows you the >> >> > position of each plot in your screen). And play also with the >> >> margins, maybe. >> >> > >> >> > Hope this is of some use to you... >> >> > >> >> > Ana >> >> > >> >> > >> >> > On Tue, 04 Jul 2006 18:12:56 +0100, J.delasHeras wrote >> >> > >> >> >>This is a bit off-topic, as it's purely R, I suppose... >> >> >> >> >> >>I am making figures containing 6 plots (MA plots, in this case), >> using: >> >> >> >> >> >>par(mfrow=c(2,3)) >> >> >> >> >> >>now, I would like to add a title, for instance, to the whole figure, >> >> >>not to the individual plots... how does one do that? I can only seem >> >> >>to add text, title etc to each plot... >> >> >> >> >> >>thanks for any pointers! >> >> >> >> >> >>Jose >> >> >> >> >> >>-- >> >> >>Dr. Jose I. de las Heras Email: >> J.delasHeras at ed.ac.uk >> >> >>The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 >> 6513374 >> >> >>Institute for Cell & Molecular Biology Fax: +44 (0)131 >> 6507360 >> >> >>Swann Building, Mayfield Road >> >> >>University of Edinburgh >> >> >>Edinburgh EH9 3JR >> >> >>UK >> >> >> >> >> >>_______________________________________________ >> >> >>Bioconductor mailing list >> >> >>Bioconductor at stat.math.ethz.ch >> >> >>https://stat.ethz.ch/mailman/listinfo/bioconductor >> >> >>Search the archives: >> >> > >> >> > http://news.gmane.org/gmane.science.biology.informatics.conductor >> >> > >> >> > >> >> > -- >> >> > IVIA (http://www.ivia.es) >> >> > Open WebMail Project (http://openwebmail.org) >> >> > Debian Project (http://www.debian.org) >> >> > >> >> > _______________________________________________ >> >> > Bioconductor mailing list >> >> > Bioconductor at stat.math.ethz.ch >> >> > https://stat.ethz.ch/mailman/listinfo/bioconductor >> >> > Search the archives: >> >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> >> >> >> >> >> -- >> >> James W. MacDonald >> >> University of Michigan >> >> Affymetrix and cDNA Microarray Core >> >> 1500 E Medical Center Drive >> >> Ann Arbor MI 48109 >> >> 734-647-5623 >> >> >> >> >> >> >> >> ********************************************************** >> >> Electronic Mail is not secure, may not be read every day, and should >> >> not be used for urgent or sensitive issues. >> >> >> >> _______________________________________________ >> >> Bioconductor mailing list >> >> Bioconductor at stat.math.ethz.ch >> >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> >> Search the archives: >> >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> >> >> > >> > >> > -- >> > Blog: http://ulrikstervbo.blogspot.com >> > Mailing-list: http://www.coollist.com/group.cgi?l=ulrik_i_berlin >> > >> > _______________________________________________ >> > Bioconductor mailing list >> > Bioconductor at stat.math.ethz.ch >> > https://stat.ethz.ch/mailman/listinfo/bioconductor >> > Search the archives: >> > http://news.gmane.org/gmane.science.biology.informatics.conductor >> > >> >> >> >> -- >> Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk >> The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 >> Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 >> Swann Building, Mayfield Road >> University of Edinburgh >> Edinburgh EH9 3JR >> UK >> >> > > > -- > Blog: http://ulrikstervbo.blogspot.com > Mailing-list: http://www.coollist.com/group.cgi?l=ulrik_i_berlin > -- Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 Swann Building, Mayfield Road University of Edinburgh Edinburgh EH9 3JR UK
ADD REPLY
0
Entering edit mode
Quoting "James W. MacDonald" <jmacdon at="" med.umich.edu="">: > You might also consider using the 'xpd' argument to par(). > > > par(xpd = NA) > > plot(1:10) > > plot(1:10) > > plot(1:10) > > plot(1:10) > > plot(1:10) > > plot(1:10) > > text(-12,28,"A header string") > > The only problem with this solution is finding where to put things. An > alternative is to use > > > text(locator(1), "A header string") and then place it where you want. > > HTH, > > Jim Hi Jim, thanks for your reply, but... I can't get that to work either :-( If I use your example, nothing happens. Only when I start using coordinates visible in my *last plot* then the text is visible, and only within that last plot... hmmm, I must be missing something obvious (I'm still newish to this...) this is an example of the figures I am trying to add text to: par(mfrow=c(2,3)) for (i in 1:3) { plot(log2(RG$Rb[,i]),log2(RG$R[,i]),pch=".") abline(0,1,col="blue")} for (i in 1:3) { plot(log2(RG$Gb[,i]),log2(RG$G[,i]),pch=".") abline(0,1,col="blue")} then, anything I try seems to work only for the very last plot of teh series. Jose -- Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 Swann Building, Mayfield Road University of Edinburgh Edinburgh EH9 3JR UK
ADD REPLY
0
Entering edit mode
>>>>> "JimMcD" == James W MacDonald <jmacdon at="" med.umich.edu=""> >>>>> on Tue, 04 Jul 2006 14:53:06 -0400 writes: JimMcD> You might also consider using the 'xpd' argument to par(). >> par(xpd = NA) >> plot(1:10) >> plot(1:10) >> plot(1:10) >> plot(1:10) >> plot(1:10) >> plot(1:10) >> text(-12,28,"A header string") JimMcD> The only problem with this solution is finding where to put things. An JimMcD> alternative is to use >> text(locator(1), "A header string") and then place it where you want. As a slightly better (most of the time) and more convenient alternative I have written the function mult.fig() more than 10 years ago {for S-plus at the time}. I still think it's nice and recommendable and even worth installing the 'sfsmisc' package: install.packages("sfsmisc") library(sfsmisc) mult.fig(6, main = "My title") for(i in 1:6) plot(rnorm(50)) ## or look at example(mult.fig) Martin Maechler, ETH Zurich JimMcD> HTH, JimMcD> Jim JimMcD> Ana Conesa wrote: >> Hi Jose, >> >> I came across this same problem some time ago and I figured out a quite >> rudimentary solution, I guess. Probably there are more elgant ones (I would >> love to know them!!!) >> Basically what I do is: >> - Split my device up into one more row, very narrow, at the upper part, to >> host the general title, and then set my first figure to spand across this >> first row. >> - Then plot a "ghost" plot in which I have made everything not visible but >> the Title. Normally you have to adjust the margins for this first "plot" in >> advance. >> - Resest the margins >> - Plot the other plots >> >> For example, for a title, plus 4 figures you could use: >> >>> layout(matrix(c(1,1,2,3,4,5),3,2, byrow=T),heights=c(1,6,6)) >>> par(mar=c(0.1,0.1,2,0.1)) >>> plot(0, main="Your Title", xaxt="n", yaxt="n", xlab="", >> >> ylab="",bty="n",col="white") >> >>> par(mar=c(c(4, 4, 4, 2))) >>> plot...what ever... >> >> >> You have to play a bit with the heights parameter of layout to get the >> division you are happy with (the function layout.show() shows you the >> position of each plot in your screen). And play also with the margins, maybe. >> >> Hope this is of some use to you... >> >> Ana >> >> >> On Tue, 04 Jul 2006 18:12:56 +0100, J.delasHeras wrote >> >>> This is a bit off-topic, as it's purely R, I suppose... >>> >>> I am making figures containing 6 plots (MA plots, in this case), using: >>> >>> par(mfrow=c(2,3)) >>> >>> now, I would like to add a title, for instance, to the whole figure, >>> not to the individual plots... how does one do that? I can only seem >>> to add text, title etc to each plot... >>> >>> thanks for any pointers! >>> >>> Jose >>> >>> -- >>> Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk >>> The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 >>> Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 >>> Swann Building, Mayfield Road >>> University of Edinburgh >>> Edinburgh EH9 3JR >>> UK >>> >>> _______________________________________________ >>> Bioconductor mailing list >>> Bioconductor at stat.math.ethz.ch >>> https://stat.ethz.ch/mailman/listinfo/bioconductor >>> Search the archives: >> >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> >> >> -- >> IVIA (http://www.ivia.es) >> Open WebMail Project (http://openwebmail.org) >> Debian Project (http://www.debian.org) >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor JimMcD> -- JimMcD> James W. MacDonald JimMcD> University of Michigan JimMcD> Affymetrix and cDNA Microarray Core JimMcD> 1500 E Medical Center Drive JimMcD> Ann Arbor MI 48109 JimMcD> 734-647-5623 JimMcD> ********************************************************** JimMcD> Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.
ADD REPLY
0
Entering edit mode
Quoting Ana Conesa <aconesa at="" ivia.es="">: > Hi Jose, > > I came across this same problem some time ago and I figured out a quite > rudimentary solution, I guess. Probably there are more elgant ones (I would > love to know them!!!) > Basically what I do is: > - Split my device up into one more row, very narrow, at the upper part, to > host the general title, and then set my first figure to spand across this > first row. > - Then plot a "ghost" plot in which I have made everything not visible but > the Title. Normally you have to adjust the margins for this first "plot" in > advance. > - Resest the margins > - Plot the other plots > > For example, for a title, plus 4 figures you could use: >> layout(matrix(c(1,1,2,3,4,5),3,2, byrow=T),heights=c(1,6,6)) >> par(mar=c(0.1,0.1,2,0.1)) >> plot(0, main="Your Title", xaxt="n", yaxt="n", xlab="", > ylab="",bty="n",col="white") >> par(mar=c(c(4, 4, 4, 2))) >> plot...what ever... > > You have to play a bit with the heights parameter of layout to get the > division you are happy with (the function layout.show() shows you the > position of each plot in your screen). And play also with the margins, maybe. > > Hope this is of some use to you... > > Ana Hi Ana, I haven't tried yet your solution, as it is a little more involved than the others... but I can see that this will work :-) So many thanks for your suggestion. If I cannot make it work in a simpler way, I'll definitely use your technique... gracias! Jose -- Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 Swann Building, Mayfield Road University of Edinburgh Edinburgh EH9 3JR UK
ADD REPLY
0
Entering edit mode
On Wednesday 05 July 2006 14:45, J.delasHeras at ed.ac.uk wrote: > Quoting Ana Conesa <aconesa at="" ivia.es="">: > > Hi Jose, > > > your suggestion. If I cannot make it work in a simpler way, I'll > definitely use your technique... gracias! > > Jose setPlotParWithTitleSpace <- function(xplots=2,yplots=2){ op <- par(mfrow = c(xplots, yplots), oma = c(0, 0, 2, 0), mar = c(5.1, 4.1, 2.1, 2.1)) return(op) } plotIt <- funtion(){ setPlotParWithTitleSpace() for (i in i1:i2) { plotMA(...) } mtext( paste("MA plots ", name ), line = 0.5, outer = TRUE, font=2 ) } and on R-help you would have gotten even more answers I guess. hth ido
ADD REPLY

Login before adding your answer.

Traffic: 747 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