baseViewports {gridBase} | R Documentation |
Generate grid Viewports from Base Plot
Description
This will generate a list of grid viewports which correspond to the current inner, figure, and plot regions of the current base plot.
Usage
baseViewports()
Details
The figure region is relative to the inner region so you must push the inner region before pushing the figure region. Similarly, the plot region is relative to the figure region so this should only be pushed after the previous two.
Value
A list with three elements:
inner |
A viewport corresponding to the inner region of the current plot. |
figure |
A viewport corresponding to the figure region of the current plot. |
plot |
A viewport corresponding to the plot region of the current plot. |
Warning
If you resize the device, all bets are off!
Author(s)
Paul Murrell
See Also
Examples
library(grid)
par(oma=rep(1, 4), mfrow=c(1, 2), xpd=NA)
plot(1:10)
vps <- baseViewports()
pushViewport(vps$inner)
grid.rect(gp=gpar(lwd=3, col="red"))
pushViewport(vps$figure)
grid.rect(gp=gpar(lwd=3, col="green"))
pushViewport(vps$plot)
grid.rect(gp=gpar(lwd=3, col="blue"))
grid.points(1:10, 10:1)
[Package gridBase version 0.4-7 Index]