grid.delay {grid} | R Documentation |
Encapsulate calculations and generating a grob
Description
Evaluates an expression that includes both calculations and generating a grob that depends on the calculations so that both the calculations and the grob generation will be rerun when the scene is redrawn (e.g., device resize or editing).
Intended only for expert use.
Usage
delayGrob(expr, list, name=NULL, gp=NULL, vp=NULL)
grid.delay(expr, list, name=NULL, gp=NULL, vp=NULL)
Arguments
expr |
object of mode |
list |
a list defining the environment in which |
name |
A character identifier. |
gp |
An object of class |
vp |
A Grid viewport object (or NULL). |
Details
A grob is created of special class "delayedgrob"
(and drawn, in the case of grid.delay
).
The makeContent
method for this class
evaluates the expression with the list as the evaluation
environment (and the grid Namespace as the parent of that
environment).
The expr
argument should return a grob as its result.
These functions are analogues of the grid.record()
and recordGrob()
functions; the difference is that
these functions are based on the makeContent()
hook,
while those functions are based on the drawDetails()
hook.
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
Examples
grid.delay({
w <- convertWidth(unit(1, "inches"), "npc")
rectGrob(width=w)
},
list())