[R] temporarily modify par values?

Jim Ottaway j.ottaway at lse.ac.uk
Sat Apr 4 13:55:44 CEST 2009


>>>>> Romain Francois <romain.francois at 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( ... ) structure( graphics::par( ... ), class = "par" )
>> with.par <- function( data, expr, ... ){
> +    old.par <- data
> +    expr
> +    invisible( par( old.par ) )
> + }
>> with( par( mar = c(0,0,0,0) ), plot( 1:10, 1:10 ) )
>> plot( 1:10, 1:10)

That looks promising, thank you very much.

Yours sincerely,
-- 
Jim Ottaway




More information about the R-help mailing list