File: baseViewports.Rd

package info (click to toggle)
r-cran-gridbase 0.4-7-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 340 kB
  • sloc: sh: 16; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 1,451 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
\name{baseViewports}
\alias{baseViewports}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{ 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.
  }
%- maybe also 'usage' for other objects documented here.
\value{
  A list with three elements:
  \item{inner }{A viewport corresponding to the inner region
    of the current plot.}
  \item{figure }{A viewport corresponding to the figure region
    of the current plot.}
  \item{plot }{A viewport corresponding to the plot region
    of the current plot.}
}
\author{ Paul Murrell }

\section{Warning}{ If you resize the device, all bets are off! }
\seealso{ \link{Grid}, \code{\link{viewport}} }
\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)
}
\keyword{ dplot }% at least one, from doc/KEYWORDS