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

From: Brahm, David <>
Date: Thu 07 Jul 2005 - 07:49:19 EST

I wrote:
> 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...

Uwe Ligges <> replied:
> Yes expected, at first you generate the plot, then you change the
> margins, and then you add stuff (axis)...
> Why do you want to use it inside the loop?

Thanks, Uwe, for making it clearer. My toy example puts these commands inside a loop because my real-life problem has them inside a function, which is called inside a loop. My function sets par(mar, usr, mgp). It seems I need to set par(mar) before frame(), par(usr) after frame(), and par(mgp) either before or after. I was not thinking of frame() as "generating the plot" so much as "moving to the next location", so I didn't understand why the order mattered. Thanks again! mailing list PLEASE do read the posting guide! Received on Thu Jul 07 07:55:36 2005

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