Usage
## S3 method for class 'default':
mosaicplot(x, main = deparse(substitute(x)), sub = NULL, xlab = NULL,
ylab = NULL, sort = NULL, off = NULL, dir = NULL,
color = FALSE, shade = !(is.null(residuals) && is.null(margin)), margin = NULL,
cex.axis = 0.66, las = par("las"), clegend = TRUE,
type = c("pearson", "deviance", "FT"), residuals = NULL, ...)
## S3 method for class 'formula':
mosaicplot(formula, data = NULL, \dots,
main = deparse(substitute(data)), subset)
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 10 at each level). There should be one
offset for each dimension of the contingency table.
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
color
logical or (recycling) vector of colors for color
shading, used only when shade
is FALSE
. The default
color=FALSE
gives empty boxes with no shading.
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
. 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.
If no marginal model and no residuals are specified,
clegend
logical. Should a color legend be plotted? (only needed
if shade
is TRUE
).
margin
a list of vectors with the marginal totals to be fit in
the log-linear model, or a formula as used in loglm
.
By default, an independence model is fitted.
See loglin
and
type
a character string indicating the type of residual to be
represented. Must be one of "pearson"
(giving components of
Pearson's $\chi^2$), "deviance"
(giving
components of the likelihood ratio $\chi^2$), or
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
to be used for plotting.
residuals
explicit argument for the residuals to be used in
extended mosaic plots.