I think this task would be easier in lattice

library(lattice)
xyplot(y + y + y + y + y + y ~ x, outer=TRUE, layout=c(1,6),
          strip=FALSE, strip.left=TRUE,
          ylab="6 copies of the Y variable",
          main="put an interesting title here")

Six different y variables instead of six copies of the same would give a
more
interesting plot:

tmp <- data.frame(matrix(rnorm(700), 100, 7,
                  dimnames=list(1:100,
c("x","y1","y2","y3","y4","y5","y6"))))
xyplot(y1 + y2 + y3 + y4 + y5 + y6 ~ x, data=tmp,
          outer=TRUE, layout=c(1,6),
          strip=FALSE, strip.left=TRUE,
          ylab="6 levels of the y response",
          main="put an interesting title here")


Rich

On Mon, Nov 19, 2012 at 10:51 AM, Richard James
<richard.j.coo...@uea.ac.uk>wrote:

> Dear colleagues,
>
> I wish to create a figure with 6 plots arranged vertically with no spacing
> between them as they all have a common x-axis.
>
> However, using the code below I'm unable to get the plot area the same size
> for each plot.
>
> The bottom plot with the x-axis label is smaller than the others, as is the
> top plot which has larger margins.
>
> How can I get the plot region the same size for all 6 plots, whislt still
> having a large enough margin for the x-axis label on the bottom plot?
>
> y<-rnorm(1:100)
> x<-rnorm(1:100)
> par(mfrow=c(6,1))
> par(mar=c(0,5,2,5))
> plot(y~x, xlab="", xaxt="n", ylab="y")
> par(mar=c(0,5,0,5))
> plot(y~x, xlab="", xaxt="n", ylab="y")
> plot(y~x, xlab="", xaxt="n", ylab="y")
> plot(y~x, xlab="", xaxt="n", ylab="y")
> plot(y~x, xlab="", xaxt="n", ylab="y")
> par(mar=c(4,5,0,5))
> plot(y~x, xlab="x", ylab="y")
>
> Regards
>
> Richard
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Plot-Area-Dimensions-tp4650051.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to