\Header{mosaicplot}{Mosaic Plots}
\begin{Usage}
\begin{verbatim}
mosaicplot(x, main = NA, sort = NA, off = NA, dir = NA, color = FALSE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{x}] a contingency table, with optional category labels
specified in the \texttt{dimnames(x)} attribute.  The table is
best created by the \texttt{table()} command, which produces an
object of type array.
\item[\texttt{main}] character string for the mosaic title.
\item[\texttt{sort}] vector ordering of the variables, containing a
permutation of the integers \texttt{1:length(dim(x))} (the
default).
\item[\texttt{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.
\item[\texttt{dir}] vector of split directions (\texttt{"v"} for vertical and
\texttt{"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.
\item[\texttt{color}] (\texttt{TRUE} or vector of integer colors) for color
shading or (\texttt{FALSE}, the default) for empty boxes with no
shading.
\end{ldescription}
\end{Arguments}
\begin{Description}
Plots a mosaic on the current graphics device.\end{Description}
\begin{Details}
See Emerson (1998) for more information and a case study with
television viewer data from Nielsen Media Research.\end{Details}
\begin{Author}
S-PLUS original by John Emerson \email{emerson@stat.yale.edu}.
Slightly modified for R by KH.\end{Author}
\begin{References}
John W. Emerson (1998).
Mosaic displays in S-PLUS: a general implementation and a case
study.
\emph{Statistical Computing and Graphics Newsletter}, \bold{9}, 1,
17--23.

The home page of Michael Friendly
(\url{http://hotspur.psych.yorku.ca/SCS/friendly.html}) provides
information on various aspects of graphical methods for analyzing
categorical data, including mosaic plots.\end{References}
\begin{Examples}
\begin{ExampleCode}
Y <- 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)
\end{ExampleCode}
\end{Examples}

