Mosaic Plot

DESCRIPTION:

Plots a mosaic on the current graphics device.

USAGE:

mosaicplot(X, main = NULL, xlab = NULL, ylab = NULL, sort = NULL,
           off = NULL, dir = NULL, color = F)

REQUIRED ARGUMENTS:

X
a contingency table, as an array or data frame.

OPTIONAL ARGUMENTS:

main, xlab, ylab
titles and sub-titles for plot.
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"=vertical and "h"=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 integer vector of colour numbers. Should the boxes by coloured?

VALUE:

None.

SIDE EFFECTS:

A mosaic plot is plotted on the current device.

REFERENCES:

Based on S code by

Jay Emerson, Yale University, February 1998
http://www.stat.yale.edu/~emerson/JCGS/index.html

Hartigan, J.A., and Kleiner, B. (1984) A mosaic of television ratings. The American Statistician, 38, 32-35.

Friendly, M. (1994) Mosaic displays for multi-way contingency tables. Journal of the American Statistical Association, 89, 190-200.

Emerson, J. W. (1998) Mosaic displays in S-PLUS: a general implementation and a case study. .uk Statistical Computing and Graphics Newsletter, 9(1), 17-23.

EXAMPLES:

caith1 <- as.matrix(caith)
names(dimnames(caith1)) <- c("eyes", "hair")
mosaicplot(caith1, color = T)
# use xtabs in R
House <- crosstabs(Freq ~ Type + Infl + Cont + Sat, housing)
mosaicplot(House, color = T)