[R] par(mfror=c(1,2))
Uwe Ligges
ligges at statistik.uni-dortmund.de
Fri Apr 28 11:02:18 CEST 2006
Another approach is to use the framework provided by package grid.
If you want to use R base graphics, you might want to look at package
gridBase as well.
BTW: There is the book on R Graphics by Paul Murrell ...
Best,
Uwe Ligges
Gavin Simpson wrote:
> On Fri, 2006-04-28 at 10:07 +0200, Stefan Semmeling wrote:
>
>>dear list,
>>
>>i have a problem using the par function.
>>
>>in one graphic device i want to have two plots so i tried to use
>>par(mfror=c(1,2)).
>>of course it worked out, but the height now is twice the length of the width
>>for each single plot.
>>what i actually wanted is something like par(mfrow=c(2,2)) where only the
>>top (or bottom)
>>two plots are drawn with entire length proportions of 1 to 2 ( height 1,
>>width 2)
>>i want to create a pdf figure and can´t figure out how that might work.
>>(e.g. the height should be 8 cm, the length 16 cm but each plot should have
>>the proportion 1:1(height:width))
>>
>>thanks for any help.
>>
>>stefan
>
>
> Is this what you mean:
>
> Square plots, 1 row, 2 cols, 8 by 16cm
>
> cmToInch <- 0.393700787
> pdf("test.pdf", paper = "special", height = 8*cmToInch, width = 16 *
> cmToInch, pointsize = 10, onefile = FALSE)
> opar <- par(mfrow = c(1,2), pty = "s")
> plot(rnorm(100), rnorm(100))
> plot(rnorm(100), rnorm(100))
> par(opar)
> dev.off()
>
> or same aspect ratio:
>
> pdf("test.pdf", paper = "special", height = 8*cmToInch, width = 16 *
> cmToInch, pointsize = 10, onefile = FALSE)
> opar <- par(mfrow = c(1,2))
> plot(rnorm(100), rnorm(100), asp = 1)
> plot(rnorm(100), rnorm(100), asp = 1)
> par(opar)
> dev.off()
>
> or both:
>
> pdf("test.pdf", paper = "special", height = 8*cmToInch, width = 16 *
> cmToInch, pointsize = 10, onefile = FALSE)
> opar <- par(mfrow = c(1,2), pty = "s")
> plot(rnorm(100), rnorm(100), asp = 1)
> plot(rnorm(100), rnorm(100), asp = 1)
> par(opar)
> dev.off()
>
> HTH,
>
> G
>
More information about the R-help
mailing list