The R Project SVN R

Rev

Rev 59039 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 59039 Rev 61433
Line 13... Line 13...
13
}
13
}
14
\usage{
14
\usage{
15
grid.clip(...)
15
grid.clip(...)
16
clipGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
16
clipGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
17
         width = unit(1, "npc"), height = unit(1, "npc"),
17
         width = unit(1, "npc"), height = unit(1, "npc"),
18
         just = "centre", hjust = NULL, vjust = NULL, 
18
         just = "centre", hjust = NULL, vjust = NULL,
19
         default.units = "npc", name = NULL, vp = NULL)
19
         default.units = "npc", name = NULL, vp = NULL)
20
}
20
}
21
\arguments{
21
\arguments{
22
  \item{x}{A numeric vector or unit object specifying x-location.}
22
  \item{x}{A numeric vector or unit object specifying x-location.}
23
  \item{y}{A numeric vector or unit object specifying y-location.}
23
  \item{y}{A numeric vector or unit object specifying y-location.}
Line 35... Line 35...
35
    If specified, overrides the \code{just} setting.}
35
    If specified, overrides the \code{just} setting.}
36
  \item{vjust}{A numeric vector specifying vertical justification.
36
  \item{vjust}{A numeric vector specifying vertical justification.
37
    If specified, overrides the \code{just} setting.}
37
    If specified, overrides the \code{just} setting.}
38
  \item{default.units}{A string indicating the default units to use
38
  \item{default.units}{A string indicating the default units to use
39
    if \code{x}, \code{y}, \code{width}, or \code{height}
39
    if \code{x}, \code{y}, \code{width}, or \code{height}
40
    are only given as numeric vectors.}  
40
    are only given as numeric vectors.}
41
  \item{name}{ A character identifier. }
41
  \item{name}{ A character identifier. }
42
  \item{vp}{A Grid viewport object (or NULL).}
42
  \item{vp}{A Grid viewport object (or NULL).}
43
  \item{\dots}{Arguments passed to \code{clipGrob}.}
43
  \item{\dots}{Arguments passed to \code{clipGrob}.}
44
}
44
}
45
\details{
45
\details{
Line 50... Line 50...
50
  Pushing or popping a viewport \emph{always} overrides the clip
50
  Pushing or popping a viewport \emph{always} overrides the clip
51
  region set by a clip grob, regardless of whether that viewport
51
  region set by a clip grob, regardless of whether that viewport
52
  explicitly enforces a clipping region.
52
  explicitly enforces a clipping region.
53
}
53
}
54
\value{
54
\value{
55
  \code{clipGrob} returns a clip grob.  
55
  \code{clipGrob} returns a clip grob.
56
}
56
}
57
\author{Paul Murrell}
57
\author{Paul Murrell}
58
\seealso{
58
\seealso{
59
  \link{Grid},
59
  \link{Grid},
60
  \code{\link{viewport}}
60
  \code{\link{viewport}}
Line 67... Line 67...
67
grid.clip(x = 0.7, width = 0.1)
67
grid.clip(x = 0.7, width = 0.1)
68
grid.lines(gp=gpar(col="red", lwd=5))
68
grid.lines(gp=gpar(col="red", lwd=5))
69
# Viewport sets new clip region
69
# Viewport sets new clip region
70
pushViewport(viewport(width=0.5, height=0.5, clip=TRUE))
70
pushViewport(viewport(width=0.5, height=0.5, clip=TRUE))
71
grid.lines(gp=gpar(col="grey", lwd=3))
71
grid.lines(gp=gpar(col="grey", lwd=3))
72
# Return to original viewport;  get 
72
# Return to original viewport;  get
73
# clip region from previous grid.clip()
73
# clip region from previous grid.clip()
74
# (NOT from previous viewport clip region)
74
# (NOT from previous viewport clip region)
75
popViewport()
75
popViewport()
76
grid.lines(gp=gpar(col="black"))
76
grid.lines(gp=gpar(col="black"))
77
}
77
}