Skip to content
Back to formatted view

Raw Message

Message-ID: <87d4bsbpkv.fsf@lse.ac.uk>
Date: 2009-04-04T11:55:44Z
From: Jim Ottaway
Subject: temporarily modify par values?

>>>>> 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