Learn R Programming

playwith (version 0.8.39)

callArg: Work with plot call arguments

Description

Part of the playwith Application Programming Interface.

Usage

callArg(playState, arg, name = NULL)
callArg(playState, arg, name = NULL) <- value

Arguments

playState
a playState object representing the plot, window and device.
arg
the argument name or number in the plot call (playState$call). Argument numbers start from 1 (so 0 refers to the function name). For setting, this can also be an expression
name
the argument name given as a character string. This is sometimes a convenient alternative to the quoted arg.
value
the value to set for argument arg.

Value

  • returns the value of the specified argument, as if using the $ or [[ extractor functions, but evaluated in a local environment (playState$env).

Details

These functions get and set argument values in the playState plot call. While it would be easy to get and set arguments in playState$call directly, these API functions help by:
  • automatically evaluating variables that have been stored in a local environment (playState$env).
  • converting lists to language objects so that the call can be deparsed elegantly.
  • enforcing exact matching of argument namesexact=TRUE(see[[).

See Also

playwith.API

Examples

Run this code
if (interactive()) {

library(lattice)
playwith(xyplot(1:10 ~ 1:10))
playState <- playDevCur()

callArg(playState, pch)  # NULL
callArg(playState, pch) <- "$"
playReplot(playState)

callArg(playState, pch)         # "$"
callArg(playState, name="pch")  # "$"

callArg(playState, scales$x$cex) <- 2
playReplot(playState)

}

Run the code above in your browser using DataLab