[R] Axis label spanning multiple plots

Andre Nathan andre at digirati.com.br
Tue Jun 2 01:46:47 CEST 2009


Thank you, layout() worked perfectly!

Another question: I'm adding some text to the plots (using text()) and
the x and y coordinates seem to always be relative the the axes of the
first call to plot(). Is there a way to reset the coordinates so that
they are relative to the latest call to plot()? That would make it
easier to position the text.

Thanks again,
Andre

On Mon, 2009-06-01 at 23:02 +0200, baptiste auguie wrote:
> sorry i misread the question -- i thought you wanted the two plots
> were in one row. Here are a few options,
> 
> 
> 1- use ggplot2 or lattice, this is the default position for the labels
> in a plot with facets
> 
> 
> > library(ggplot2)
> > qplot(mpg, wt, data=mtcars, facets=vs ~ .)
> 
> 
> 2- use layout() or split.screen() or the gridBase package to split the
> window in three regions, 
> 
> 
> > layout(matrix(c(3,1,3,2), 2, 2, byrow = TRUE), width=c(1,5))
> > layout.show(3)
> > plot(1:10)
> > plot(1:10)
> > plot.new() # necessary to draw something here
> > text(0.5,0.5,"y label",srt=90)
> > 
> 
> 
> HTH,
> 
> 
> baptiste
> 
> On 1 Jun 2009, at 22:30, Andre Nathan wrote:
> 
> > On Mon, 2009-06-01 at 22:24 +0200, baptiste auguie wrote:
> > > you can use title() with the sub argument,
> > > 
> > > title(sub="x label", outer=T) # you might want to play around
> > > with  
> > > line argument
> > 
> > Can title() span two plots? I'm trying to use a single title for two
> > plots, something like
> > 
> >    +------------+
> >  t |            |
> >    |            |
> >  i |            |
> >    +------------+
> >  t
> >    +------------+
> >  l |            |
> >    |            |
> >  e |            |
> >    +------------+
> > 
> > 
> > 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
> ______________________________
> 
> 
>




More information about the R-help mailing list