[R] several common sub-axes within multiple plot area

Greg Snow Greg.Snow at imail.org
Mon Jun 28 19:32:32 CEST 2010


How about:

#my example:
dev.new()

layout( rbind( c(1,2), c(7,7), c(3,4), c(8,8), c(5,6), c(9,9) ),
 		heights=c(10,1,10,1,10,1) )
 

#Graph 1:
plot(rnorm(20), rnorm(20),
      xlab = "Results 1 (Int)",
      ylab = "Variable A",
      main = "Factor X")
#Graph 2:
plot(rnorm(20), rnorm(20),
      xlab = "Results 1 (Int)",
      ylab = "Variable A",
      main = "Factor Y")
#Graph 3:
plot(rnorm(20), rnorm(20),
      xlab = "Results 2 (Int)",
      ylab = "Variable B")
#Graph 4:
plot(rnorm(20), rnorm(20),
      xlab = "Results 2 (Int)",
      ylab = "Variable B")
#Graph 5:
plot(rnorm(20), rnorm(20),
      xlab = "Results 3 (Int)",
      ylab = "Variable C")
#Graph 6:
plot(rnorm(20), rnorm(20),
      xlab = "Results 3 (Int)",
      ylab = "Variable C")

par(mar=rep(0,4))
plot.new()
text( .5, .5, "Results 1 (Int)", font=2, cex=1.5 )
plot.new()
text( .5, .5, "Results 2 (Int)", font=2, cex=1.5 )
plot.new()
text( .5, .5, "Results 3 (Int)", font=2, cex=1.5 )








-- 
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 Karl Brand
> Sent: Saturday, June 26, 2010 7:21 AM
> To: r-help at r-project.org
> Subject: [R] several common sub-axes within multiple plot area
> 
> Dear List,
> 
> I'd really appreciate tip's or code demonstrating how i can achieve
> some
> common axis labels integrated into a multiple plot.
> 
> In my example (below), i'm trying to achieve:
> 
> -a single "Results 1 (Int)" centered & btwn row 1 and row 2;
> -a single "Results 2 (Int)" centered & btwn row 2 and row 3;  and,
> -a single "Results 3 (Int)" centered at the bottom, ie., below row 3.
> 
> I played with mtext() and par(oma=... per this post-
> 
> https://stat.ethz.ch/pipermail/r-help/2004-October/059453.html
> 
> But have so far failed to achieve my goal. Can i succeed with something
> combined with the 'high level' plot() function? Or do i need to get
> specific with some low level commands (help!)?
> 
> With big thanks in advance for any suggestions/examples.
> 
> cheers,
> 
> Karl
> 
> #my example:
> dev.new()
> plot.new()
> par(mfrow=c(3,2))
> #Graph 1:
> plot(rnorm(20), rnorm(20),
>       xlab = "Results 1 (Int)",
>       ylab = "Variable A",
>       main = "Factor X")
> #Graph 2:
> plot(rnorm(20), rnorm(20),
>       xlab = "Results 1 (Int)",
>       ylab = "Variable A",
>       main = "Factor Y")
> #Graph 3:
> plot(rnorm(20), rnorm(20),
>       xlab = "Results 2 (Int)",
>       ylab = "Variable B")
> #Graph 4:
> plot(rnorm(20), rnorm(20),
>       xlab = "Results 2 (Int)",
>       ylab = "Variable B")
> #Graph 5:
> plot(rnorm(20), rnorm(20),
>       xlab = "Results 3 (Int)",
>       ylab = "Variable C")
> #Graph 6:
> plot(rnorm(20), rnorm(20),
>       xlab = "Results 3 (Int)",
>       ylab = "Variable C")
> 
> 
> --
> Karl Brand
> Department of Genetics
> Erasmus MC
> Dr Molewaterplein 50
> 3015 GE Rotterdam
> T +31 (0)10 704 3457 |F +31 (0)10 704 4743 |M +31 (0)642 777 268
> 
> ______________________________________________
> 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.



More information about the R-help mailing list