[R] temporarily modify par values?
Jim Ottaway
j.ottaway at lse.ac.uk
Sat Apr 4 18:32:52 CEST 2009
>>>>> Gabor Grothendieck <ggrothendieck at 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 expr invisibly so that this works:
> bp <- with(par(mar = c(4, 1, 1, 1)), boxplot(1:10))
Thank you very much, that looks like a better way of cleaning up with an
error too than my attempt.
Yours sincerely,
--
Jim Ottaway
More information about the R-help
mailing list