baseViewports: Generate grid Viewports from Base Plot

Description Usage Details Value Warning Author(s) See Also Examples

View source: R/base.R

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

1

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

Grid, viewport

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

Example output



gridBase documentation built on May 1, 2019, 10:49 p.m.