[R] Graphics: calling par(mar) after frame()
Uwe Ligges
ligges at statistik.uni-dortmund.de
Wed Jul 6 23:09:36 CEST 2005
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 at alum.mit.edu)
>
> ______________________________________________
> R-help at 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
More information about the R-help
mailing list