Evaluates an expression that includes both calculations
and drawing that depends on the calculations so that
both the calculations and the drawing will be rerun when
the scene is redrawn (e.g., device resize or editing).
object of mode expression or call or
an unevaluated expression.
list
a list defining the environment in which expr is to
be evaluated.
name
A character identifier.
gp
An object of class gpar, typically the output
from a call to the function gpar. This is basically
a list of graphical parameter settings.
vp
A Grid viewport object (or NULL).
Details
A grob is created of special class "recordedGrob"
(and drawn, in the case of grid.record).
The drawDetails method for this class
evaluates the expression with the list as the evaluation
environment (and the grid Namespace as the parent of that
environment).
Note
This function must be used instead of the
function recordGraphics; all of the dire warnings
about using recordGraphics responsibly also apply here.
Author(s)
Paul Murrell
See Also
recordGraphics
Examples
grid.record({
w <- convertWidth(unit(1, "inches"), "npc")
grid.rect(width=w)
},
list())
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(grid)
> png(filename="/home/ddbj/snapshot/RGM3/R_rel/result/grid/grid.record.Rd_%03d_medium.png", width=480, height=480)
> ### Name: grid.record
> ### Title: Encapsulate calculations and drawing
> ### Aliases: grid.record recordGrob
> ### Keywords: dplot
>
> ### ** Examples
>
> grid.record({
+ w <- convertWidth(unit(1, "inches"), "npc")
+ grid.rect(width=w)
+ },
+ list())
>
>
>
>
>
> dev.off()
null device
1
>