The R Project SVN R

Rev

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

Rev 26327 Rev 26788
Line 7... Line 7...
7
}
7
}
8
\usage{
8
\usage{
9
grid.layout(nrow = 1, ncol = 1,
9
grid.layout(nrow = 1, ncol = 1,
10
        widths = unit(rep(1, ncol), "null"),
10
        widths = unit(rep(1, ncol), "null"),
11
        heights = unit(rep(1, nrow), "null"),
11
        heights = unit(rep(1, nrow), "null"),
12
        default.units = "null", respect = FALSE)
12
        default.units = "null", respect = FALSE,
-
 
13
        just="centre")
13
}
14
}
14
\arguments{
15
\arguments{
15
  \item{nrow}{An integer describing the number of rows in the layout.}
16
  \item{nrow}{An integer describing the number of rows in the layout.}
16
  \item{ncol}{An integer describing the number of columns in the layout.}
17
  \item{ncol}{An integer describing the number of columns in the layout.}
17
  \item{widths}{A numeric vector or unit object
18
  \item{widths}{A numeric vector or unit object
Line 22... Line 23...
22
    in the layout.}
23
    in the layout.}
23
  \item{default.units}{A string indicating the default units to use
24
  \item{default.units}{A string indicating the default units to use
24
    if \code{widths} or \code{heights} are only given as numeric vectors.}  
25
    if \code{widths} or \code{heights} are only given as numeric vectors.}  
25
  \item{respect}{A logical value indicating whether
26
  \item{respect}{A logical value indicating whether
26
    row heights and column widths should respect each other.}
27
    row heights and column widths should respect each other.}
-
 
28
  \item{just}{A string vector indicating how the layout should be
-
 
29
    justified if it is not the same size as its parent viewport.
-
 
30
    If there are two values, the first
-
 
31
    value specifes horizontal justification and the second value specifies
-
 
32
    vertical justification.  Possible values are: \code{"left"},
-
 
33
    \code{"right"}, \code{"centre"}, \code{"center"}, \code{"bottom"},
-
 
34
    and \code{"top"}.  NOTE that in this context,
-
 
35
    \code{"left"}, for example, means align the left
-
 
36
    edge of the left-most layout column with the left edge of the
-
 
37
    parent viewport.}}
27
}
38
}
28
\details{
39
\details{
29
  The unit objects given for the \code{widths} and \code{heights}
40
  The unit objects given for the \code{widths} and \code{heights}
30
  of a layout may use a special \code{units} that only has
41
  of a layout may use a special \code{units} that only has
31
  meaning for layouts.  This is the \code{"null"} unit, which
42
  meaning for layouts.  This is the \code{"null"} unit, which
Line 58... Line 69...
58
  \code{\link{layout}}}
69
  \code{\link{layout}}}
59
 
70
 
60
\examples{
71
\examples{
61
## A variety of layouts (some a bit mid-bending ...)
72
## A variety of layouts (some a bit mid-bending ...)
62
layout.torture()
73
layout.torture()
-
 
74
## Demonstration of layout justification
-
 
75
grid.newpage()
-
 
76
testlay <- function(just="centre") {
-
 
77
  pushViewport(viewport(layout=grid.layout(1, 1, widths=unit(1, "inches"),
-
 
78
                          height=unit(0.25, "npc"),
-
 
79
                          just=just)))
-
 
80
  pushViewport(viewport(layout.pos.col=1, layout.pos.row=1))
-
 
81
  grid.rect()
-
 
82
  grid.text(paste(just, collapse="-"))
-
 
83
  popViewport(2)
-
 
84
}
-
 
85
testlay()
-
 
86
testlay(c("left", "top"))
-
 
87
testlay(c("right", "top"))
-
 
88
testlay(c("right", "bottom"))
-
 
89
testlay(c("left", "bottom"))
-
 
90
testlay(c("left"))
-
 
91
testlay(c("right"))
-
 
92
testlay(c("bottom"))
-
 
93
testlay(c("top"))
63
}
94
}
64
\keyword{dplot}
95
\keyword{dplot}