| mosaic {regclass} | R Documentation |
Mosaic plot
Description
Provides a mosaic plot to visualize the association between two categorical variables
Usage
mosaic(formula,data,color=TRUE,labelat=c(),xlab=c(),ylab=c(),
magnification=1,equal=FALSE,inside=FALSE,ordered=FALSE)
Arguments
formula |
A standard R formula written as y~x, where y is the name of the variable playing the role of y and x is the name of the variable playing the role of x. |
data |
An optional argument giving the name of the data frame that contains x and y. If not specified, the function will use existing definitions in the parent environment. |
color |
|
labelat |
a vector of factor levels of |
xlab |
Label of horizontal axis if you want something different that the name of the |
ylab |
Label of vertical axis if you want something different that the name of the |
magnification |
Magnification of the labels of the |
equal |
If |
inside |
If |
ordered |
If |
Details
This function shows a mosaic plot to visualize the conditional distributions of y for each level of x, along with the marginal distribution of y to the right of the plot. The widths of the segmented bar charts are proportional to the frequency of each level of x. These plots are the same that appear using associate.
Author(s)
Adam Petrie
References
Introduction to Regression and Modeling
See Also
Examples
data(ACCOUNT)
mosaic(Area.Classification~Purchase,data=ACCOUNT,color=TRUE)
data(EX6.CLICK)
#Default presentation: not very useful
mosaic(Click~DeviceModel,data=EX6.CLICK)
#Better presentation
mosaic(Click~DeviceModel,data=EX6.CLICK,equal=TRUE,inside=TRUE,magnification=0.8)