[R] temporarily modify par values?

2009-04-04 Thread Jim Ottaway
Is there some sort of 'with.par' function that temporarily changes par parameters and then re-sets them so that instead of doing things such as opar - par(mar=c(4.1,4.1,4.1,8),...) do things par(opar) you can do something like with.par(mar=c(4.1,4.1,4.1,8),..., do things) where all but

Re: [R] temporarily modify par values?

2009-04-04 Thread Romain Francois
Jim Ottaway wrote: Is there some sort of 'with.par' function that temporarily changes par parameters and then re-sets them so that instead of doing things such as opar - par(mar=c(4.1,4.1,4.1,8),...) do things par(opar) you can do something like with.par(mar=c(4.1,4.1,4.1,8),..., do

Re: [R] temporarily modify par values?

2009-04-04 Thread Jim Ottaway
Romain Francois romain.franc...@dbmail.com writes: Jim Ottaway wrote: Is there some sort of 'with.par' function that temporarily changes par parameters and then re-sets them so that instead of doing things such as with is generic, so you could do something like that: par - function( ... )

Re: [R] temporarily modify par values?

2009-04-04 Thread Jim Ottaway
Romain Francois romain.franc...@dbmail.com writes: with is generic, so you could do something like that: par - function( ... ) structure( graphics::par( ... ), class = par ) with.par - function( data, expr, ... ){ +old.par - data +expr +invisible( par( old.par ) ) + } with(

Re: [R] temporarily modify par values?

2009-04-04 Thread Gabor Grothendieck
Here is a minor variation: par - function( ... ) structure( graphics::par( ... ), class = par ) with.par - function( data, expr, ... ) { on.exit(par(old.par, no.readonly = TRUE)) old.par - data invisible(expr) } which returns expr invisibly so that this works: bp - with(par(mar = c(4,

Re: [R] temporarily modify par values?

2009-04-04 Thread Jim Ottaway
Gabor Grothendieck ggrothendi...@gmail.com writes: Here is a minor variation: par - function( ... ) structure( graphics::par( ... ), class = par ) with.par - function( data, expr, ... ) { on.exit(par(old.par, no.readonly = TRUE)) old.par - data invisible(expr) } which returns