Learn R Programming

R.devices (version 2.11.0)

withPar: Evaluate an R expression with graphical parameters set temporarily

Description

Evaluate an R expression with graphical parameters set temporarily.

Usage

withPar(expr, ..., args=list(), envir=parent.frame())

Arguments

expr
The R expression to be evaluated.
...
Named options to be used.
args
(optional) Additional named options specified as a named list.
envir
The environment in which the expression should be evaluated.

Value

  • Returns the results of the expression evaluated.

See Also

Internally, eval() is used to evaluate the expression, and par to set graphical parameters.

Examples

Run this code
withPar({
  layout(1:4)

  withPar({
    plot(1:10)
    plot(10:1)
  }, pch=4)

  withPar({
    plot(1:10)
    plot(10:1)
  }, pch=0, bg="yellow")
}, mar=c(2,2,1,1))

Run the code above in your browser using DataLab