Re: [R] Graphics: calling par(mar) after frame()

From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>
Date: Thu 07 Jul 2005 - 07:09:36 EST

Brahm, David wrote:

> The following code produces 6 plots on a page, but the first is
> distorted and different from the others:
>
> par(mfrow=c(3,2), las=2)
> for (i in 1:6) {
> frame()
> par(mar=c(7, 7, 1, 1))
> axis(2); box(); abline(h=seq(0,1,.5), col=2:4)
> }
>
> The first plot's axes are mis-aligned with the plotting area implied
> by the box. It seems to be a result of calling par(mar) after frame().
> Is this expected behavior, or some kind of bug?

Yes expected, at first yiou generate the plot, then you change the margins, and then you add stuff (axis).
For the second plot, par(mar) has already been called in the first iteration.

Why do you want to use it inside the loop?

Uwe Ligges

> I'm using R-2.1.0 on Linux with X11; I see the same behavior in Windows.
>
> -- David Brahm (brahm@alum.mit.edu)
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jul 07 07:11:19 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:18 EST