[R] par(mfror=c(1,2))
Gavin Simpson
gavin.simpson at ucl.ac.uk
Fri Apr 28 10:47:47 CEST 2006
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
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
* Note new Address, Telephone & Fax numbers from 6th April 2006 *
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson
ECRC & ENSIS [t] +44 (0)20 7679 0522
UCL Department of Geography [f] +44 (0)20 7679 0565
Pearson Building [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street [w] http://www.ucl.ac.uk/~ucfagls/cv/
London, UK. [w] http://www.ucl.ac.uk/~ucfagls/
WC1E 6BT.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the R-help
mailing list