Usage
mosaicplot(x, ...)
"mosaicplot"(x, main = deparse(substitute(x)), sub = NULL, xlab = NULL, ylab = NULL, sort = NULL, off = NULL, dir = NULL, color = NULL, shade = FALSE, margin = NULL, cex.axis = 0.66, las = par("las"), border = NULL, type = c("pearson", "deviance", "FT"), ...)
"mosaicplot"(formula, data = NULL, ..., main = deparse(substitute(data)), subset, na.action = stats::na.omit)
Arguments
x
a contingency table in array form, with optional category
labels specified in the dimnames(x)
attribute. The table is
best created by the table()
command.
main
character string for the mosaic title.
sub
character string for the mosaic sub-title (at bottom).
xlab, ylab
x- and y-axis labels used for the plot; by default,
the first and second element of names(dimnames(X))
(i.e., the
name of the first and second variable in X
).
sort
vector ordering of the variables, containing a permutation
of the integers 1:length(dim(x))
(the default).
off
vector of offsets to determine percentage spacing at each
level of the mosaic (appropriate values are between 0 and 20,
and the default is 20 times the number of splits for 2-dimensional
tables, and 10 otherwise. Rescaled to maximally 50, and recycled if
necessary.
dir
vector of split directions ("v"
for vertical and
"h"
for horizontal) for each level of the mosaic, one
direction for each dimension of the contingency table. The
default consists of alternating directions, beginning with a
vertical split.
color
logical or (recycling) vector of colors for color
shading, used only when shade
is FALSE
, or NULL
(default). By default, grey boxes are drawn. color = TRUE
uses a gamma-corrected grey palette. color = FALSE
gives empty
boxes with no shading.
shade
a logical indicating whether to produce extended mosaic
plots, or a numeric vector of at most 5 distinct positive numbers
giving the absolute values of the cut points for the residuals. By
default, shade
is FALSE
, and simple mosaics are
created. Using shade = TRUE
cuts absolute values at 2 and
4.
margin
a list of vectors with the marginal totals to be fit in
the log-linear model. By default, an independence model is fitted.
See loglin
for further information. cex.axis
The magnification to be used for axis annotation,
as a multiple of par("cex")
.
las
numeric; the style of axis labels, see par
. border
colour of borders of cells: see polygon
. type
a character string indicating the type of residual to be
represented. Must be one of "pearson"
(giving components of
Pearson's $chi-squared$), "deviance"
(giving
components of the likelihood ratio $chi-squared$), or
"FT"
for the Freeman-Tukey residuals. The value of this
argument can be abbreviated.
formula
a formula, such as y ~ x
.
data
a data frame (or list), or a contingency table from which
the variables in formula
should be taken.
...
further arguments to be passed to or from methods.
subset
an optional vector specifying a subset of observations
in the data frame to be used for plotting.
na.action
a function which indicates what should happen
when the data contains variables to be cross-tabulated, and these
variables contain NA
s. The default is to omit cases which
have an NA
in any variable. Since the tabulation will omit
all cases containing missing values, this will only be useful if the
na.action
function replaces missing values.