baseViewports

0th

Percentile

Generate grid Viewports from Base Plot

This will generate a list of grid viewports which correspond to the current inner, figure, and plot regions of the current base plot.

Keywords
dplot
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!

See Also

Grid, viewport

Aliases
  • baseViewports
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)
Documentation reproduced from package gridBase, version 0.4-7, License: GPL

Community examples

Looks like there are no examples yet.