| grid.echo {gridGraphics} | R Documentation |
Convert a scene that was drawn using the graphics package to an identical scene drawn with the grid package.
grid.echo(x = NULL, newpage = TRUE, prefix = NULL, device = offscreen)
x |
Either |
newpage |
A logical value indicating whether to start a new page. If
|
prefix |
A character value used as a prefix for all grob and viewport names.
The default prefix is |
device |
A function that opens a graphics device for |
If the first argument is a function, it must be a function with zero arguments. If the function needs access to non-global data, use a closure. The function should not call functions that create or destroy graphics devices, or change the current graphics device.
This function is called for its side-effect of drawing on the current graphics device.
Paul Murrell
## Not run: # Echo existing drawing plot(1) grid.echo() # Echo result of call to a plotting function plotfun <- function() plot(1:10) grid.echo(plotfun) # Echo result of a plotting function (anonymous) into current viewport grid.newpage() pushViewport(viewport(x=0, width=.5, just="left")) grid.rect(gp=gpar(col=NA, fill="grey")) grid.echo(function() plot(1:10), newpage=FALSE) ## End(Not run)