
recordGraphics(expr, list, env)
expression
or call
or
an unevaluated expression.expr
is to
be evaluated.environment
specifying
where R looks for objects not found in
envir
.expr
.
assign
function
to performing assignments in the global environment.expr
is evaluated in an environment constructed
from list
, with env
as the parent of that environment.All three arguments are saved on the graphics engine display list so that on a device resize or copying between devices, the original evaluation environment can be recreated and the code can be re-evaluated to reproduce the graphical output.
eval
require(graphics)
plot(1:10)
# This rectangle remains 1inch wide when the device is resized
recordGraphics(
{
rect(4, 2,
4 + diff(par("usr")[1:2])/par("pin")[1], 3)
},
list(),
getNamespace("graphics"))
Run the code above in your browser using DataLab