mosaicplot(x, main = NA, sort = NA, off = NA, dir = NA, color = FALSE)
x
|
a contingency table, with optional category labels
specified in the dimnames(x) attribute. The table is
best created by the table() command, which produces an
object of type array.
|
main
| character string for the mosaic title. |
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 with a
vertical split.
|
color
|
(TRUE or vector of integer colors) for color
shading or (FALSE , the default) for empty boxes with no
shading.
|
The home page of Michael Friendly (http://hotspur.psych.yorku.ca/SCS/friendly.html) provides information on various aspects of graphical methods for analyzing categorical data, including mosaic plots.
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)