grid.reduce | R Documentation |
This function takes a grob (or gTree) that draws multiple shapes and reduces it to a grob that only draws one shape.
More accurately, the result only draws at most one closed shape and at most one open shape.
reduceGrob(x, op=if (isClosedShape(x)) "union" else "flatten",
openFn=xyListToLine, closedFn=xyListToPath,
name=NULL, gp=gpar())
grid.reduce(x, ...)
x |
A grob, gList, or gTree, or a gPath or a character value identifying a grob that has already been drawn. |
op |
A character value describing the operation. One of
|
openFn |
The function used to create grobs from the open shapes in the result. |
closedFn |
The function used to create grobs from the closed shapes in the result. |
name |
A name for the resulting grob. |
gp |
Graphical parameter settings for the resulting grob. |
... |
For |
Multiple shapes are combined using polyclip()
and the
specified operator op
.
reduceGrob
returns a gTree with two children, one
representing the open shapes within the result and one representing the
closed shapes within the result.
grid.reduce
is only used for its side-effect of drawing
on the current graphics device.
Paul Murrell
grid.polyclip
r <- rectGrob(x=1/3, y=1/3, width=.4, height=.4)
c <- circleGrob(x=2/3, y=2/3, r=.3)
grid.reduce(grobTree(r, c), gp=gpar(fill="grey"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.