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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gtable-layouts.R
\name{gtable_matrix}
\alias{gtable_matrix}
\title{Create a gtable from a matrix of grobs.}
\usage{
gtable_matrix(
name,
grobs,
widths = NULL,
heights = NULL,
z = NULL,
respect = FALSE,
clip = "on",
vp = NULL
)
}
\arguments{
\item{name}{a string giving the name of the table. This is used to name
the layout viewport}
\item{grobs}{a single grob or a list of grobs}
\item{widths}{a unit vector giving the width of each column}
\item{heights}{a unit vector giving the height of each row}
\item{z}{a numeric matrix of the same dimensions as \code{grobs},
specifying the order that the grobs are drawn.}
\item{respect}{a logical vector of length 1: should the aspect ratio of
height and width specified in null units be respected. See
\code{\link[=grid.layout]{grid.layout()}} for more details}
\item{clip}{should drawing be clipped to the specified cells
(\code{"on"}), the entire table (\code{"inherit"}), or not at all
(\code{"off"})}
\item{vp}{a grid viewport object (or NULL).}
}
\value{
A gtable of the same dimensions as the grobs matrix.
}
\description{
This function takes a matrix of grobs and create a gtable matching with the
grobs in the same position as they were in the matrix, with the given heights
and widths.
}
\examples{
library(grid)
a <- rectGrob(gp = gpar(fill = "red"))
b <- circleGrob()
c <- linesGrob()
row <- matrix(list(a, b, c), nrow = 1)
col <- matrix(list(a, b, c), ncol = 1)
mat <- matrix(list(a, b, c, nullGrob()), nrow = 2)
gtable_matrix("demo", row, unit(c(1, 1, 1), "null"), unit(1, "null"))
gtable_matrix("demo", col, unit(1, "null"), unit(c(1, 1, 1), "null"))
gtable_matrix("demo", mat, unit(c(1, 1), "null"), unit(c(1, 1), "null"))
# Can specify z ordering
z <- matrix(c(3, 1, 2, 4), nrow = 2)
gtable_matrix("demo", mat, unit(c(1, 1), "null"), unit(c(1, 1), "null"), z = z)
}
\seealso{
Other gtable construction:
\code{\link{gtable}()},
\code{\link{gtable_col}()},
\code{\link{gtable_row}()},
\code{\link{gtable_spacer}}
}
\concept{gtable construction}
|