Rev 3076 | Blame | Last modification | View Log | Download | RSS feed
\name{mosaicplot}\alias{mosaicplot}\title{Mosaic Plots}\usage{mosaicplot(x, \dots)mosaicplot.default (X, main = NULL, xlab = NULL, ylab = NULL,sort = NULL, off = NULL,dir = NULL, color = FALSE)}\arguments{\item{x}{a contingency table, with optional category labelsspecified in the \code{dimnames(x)} attribute. The table isbest created by the \code{table()} command, which produces anobject of type array.}\item{main}{character string for the mosaic title.}\item{xlab,ylab}{x- and y-axis labels; by default,\code{names(dimnames(X))}.}\item{sort}{vector ordering of the variables, containing apermutation of the integers \code{1:length(dim(x))} (thedefault).}\item{off}{vector of offsets to determine percentage spacing at eachlevel of the mosaic (appropriate values are between 0 and 20,and the default is 10 at each level). There should be oneoffset for each dimension of the contingency table.}\item{dir}{vector of split directions (\code{"v"} for vertical and\code{"h"} for horizontal) for each level of the mosaic, onedirection for each dimension of the contingency table. Thedefault consists of alternating directions, beginning with avertical split.}\item{color}{(\code{TRUE} or vector of integer colors) for colorshading or (\code{FALSE}, the default) for empty boxes with noshading.}}\description{Plots a mosaic on the current graphics device.}\details{See Emerson (1998) for more information and a case study withtelevision viewer data from Nielsen Media Research.}\author{S-PLUS original by John Emerson \email{emerson@stat.yale.edu}.Slightly modified for \R by KH.}\references{Hartigan, J.A., and Kleiner, B. (1984).A mosaic of television ratings. \emph{The American Statistician},\bold{38}, 32-35.John W. Emerson (1998).Mosaic displays in S-PLUS: a general implementation and a case study.\emph{Statistical Computing and Graphics Newsletter (ASA)},\bold{9}, 1, 17-23.Friendly, M. (1994).Mosaic displays for multi-way contingency tables.\emph{Journal of the American Statistical Association}, \bold{89}, 190-200.\crThe home page of Michael Friendly(\url{http://hotspur.psych.yorku.ca/SCS/friendly.html}) providesinformation on various aspects of graphical methods for analyzingcategorical data, including mosaic plots.}\examples{## Use interesting data!## Artificial 4-way tableY <- table(trunc(3*runif(1000)), trunc(3*runif(1000)),trunc(5*runif(1000))-10, trunc(3*runif(1000)))dimnames(Y)[[2]] <- c("Cat", "Dog", "Horse")mosaicplot(Y, main = "Sample Mosaic", color = TRUE)}