[R] 'par mfrow' and not filling horizontally
Bert Gunter
gunter.berton at gene.com
Wed Sep 8 21:16:15 CEST 2010
Ted:
?layout
Is this close to what you want?
layout(matrix(1:2, nrow=2),wid=1,heigh=c(1,1), resp= TRUE)
set.seed(54321)
X0 <- rnorm(50) ; Y0 <- rnorm(50)
plot(X0,Y0,pch="+",col="blue",xlim=c(-3,3),ylim=c(-3,3),
xlab="X",ylab="Y",main="My Plot",asp=1)
plot(X0,Y0,pch="+",col="blue",xlim=c(-3,3),ylim=c(-3,3),
xlab="X",ylab="Y",main="My Plot",asp=1)
On Wed, Sep 8, 2010 at 12:01 PM, Ted Harding
<Ted.Harding at manchester.ac.uk> wrote:
> Greetings, Folks.
> I'd appreciate being shown the way out of this one!
> I've been round the documentation in ever-drecreasing
> circles, and along other paths, without stumbling on
> the answer.
>
> The background to the question can be exemplified by
> the example (no graphics window open to start with):
>
> set.seed(54321)
> X0 <- rnorm(50) ; Y0 <- rnorm(50)
>
> par(mfrow=c(2,1),mfg=c(1,1),cex=0.5)
> plot(X0,Y0,pch="+",col="blue",xlim=c(-3,3),ylim=c(-3,3),
> xlab="X",ylab="Y",main="My Plot",asp=1)
>
> par(mfg=c(2,1))
> plot(X0,Y0,pch="+",col="blue",xlim=c(-3,3),ylim=c(-3,3),
> xlab="X",ylab="Y",main="My Plot",asp=1)
>
> As you will see, both plots have been extended laterally
> to fill the plotting area horizontally, hence extend from
> approx X = -8 to approx X = +8 (on my X11 display), despite
> the xlim=c(-3,3); however, the "ylim=c(-3,3)" has been
> respected, as has "asp=1".
>
> What I would like to see, independently of the shape of
> the graphics window, is a pair of square plots, each with
> X and Y ranging from -3 to 3, even if this leaves empty
> space in the graphics window on either side.
>
> Hints?
>
> With thanks,
> Ted.
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
> Fax-to-email: +44 (0)870 094 0861
> Date: 08-Sep-10 Time: 20:01:19
> ------------------------------ XFMail ------------------------------
>
> ______________________________________________
> 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.
>
--
Bert Gunter
Genentech Nonclinical Biostatistics
467-7374
http://devo.gene.com/groups/devo/depts/ncb/home.shtml
More information about the R-help
mailing list