Create an outer margin (see ?par), then use mtext to put the title in the outer margin. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of Andre Nathan > Sent: Wednesday, May 27, 2009 1:40 PM > To: r-help at r-project.org > Subject: [R] Axis label spanning multiple plots > > Hello > > I need to plot 3 graphs in a single column; the top two plots have the > same title, and I would like it to be written only once, centered > horizontally and spanning the two plots. Something like > > > t +------------+ > | | > i | | > | | > t +------------+ > > l +------------+ > | | > e | | > | | > 1 +------------+ > > t +------------+ > i | | > t | | > l | | > e | | > 2 +------------+ > > x-title > > Is there a parameter which allows me to do that automatically, or > should > I use text() and position the title manually? > > Thanks in advance, > Andre > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code.
Hello I need to plot 3 graphs in a single column; the top two plots have the same title, and I would like it to be written only once, centered horizontally and spanning the two plots. Something like t +------------+ | | i | | | | t +------------+ l +------------+ | | e | | | | 1 +------------+ t +------------+ i | | t | | l | | e | | 2 +------------+ x-title Is there a parameter which allows me to do that automatically, or should I use text() and position the title manually? Thanks in advance, Andre
Hello On Wed, 2009-05-27 at 13:38 -0600, Greg Snow wrote:> Create an outer margin (see ?par), then use mtext to put the title in the outer margin.Sorry for taking that long to reply... I created an outer margin with par(oma = c (0, 2, 0, 0)) and then did par(mfrow = c(2, 1)) plot(...) plot(...) mtext("title 1", side = 2, outer = T) With that, the text "title 1" appears to the left of the second plot, and not to the left of both plots, centered between them, which is what I was trying to do. Is there a way to accomplish that (without manual text positioning, that is)? Thanks, Andre
you can use title() with the sub argument, title(sub="x label", outer=T) # you might want to play around with line argument baptiste On 1 Jun 2009, at 22:03, Andre Nathan wrote:> Hello > > On Wed, 2009-05-27 at 13:38 -0600, Greg Snow wrote: >> Create an outer margin (see ?par), then use mtext to put the title >> in the outer margin. > > Sorry for taking that long to reply... > > I created an outer margin with > > par(oma = c (0, 2, 0, 0)) > > and then did > > par(mfrow = c(2, 1)) > plot(...) > plot(...) > mtext("title 1", side = 2, outer = T) > > With that, the text "title 1" appears to the left of the second plot, > and not to the left of both plots, centered between them, which is > what > I was trying to do. Is there a way to accomplish that (without manual > text positioning, that is)? > > Thanks, > Andre > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code._____________________________ Baptiste Augui? School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag