Library: | plot |
See also: |
Quantlet: | plotmosaic | |
Description: | Graphical Contingency Table |
Usage: | plotmosaic(inX {,inY}) | |
Input: | ||
inX | n x 1 Vector, discrete. | |
inY | n x 1 Vector, discrete. |
The labels are centered at the relative frequencies for the unconditioned groups within x resp. y.
If y is omitted, a so called "spineplot" is generated for x. This is a barchart where the height is constant (in this case 1) and the width of the bars is proportional to the frequencies of the groups within x.
Requires the library "stats".
library("plot") library("stats") x1 = #("one", "one", "one", "one", "one", "one", "one", "one") x1 = x1 | #("two", "two", "two", "two", "two", "two", "three") x1 = x1 | #("three", "three", "three") y1 = #("one", "one", "two", "two", "three", "three", "four") y1 = y1 | #("four", "one", "one", "one", "two", "two", "two") y1 = y1 | #("one", "four", "four", "four") plotmosaic(x1, y1) x2 = #(1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3) y2 = #(1, 1, 2, 2, 3, 3, 4, 4, 1, 1, 1, 2, 2, 2, 1, 4, 4, 4) plotmosaic(x2, y2)
Both calls of plotmosaic() generate a mosaic plot of x and y. Note how the different orderings (alphabetical) influence the appearence of the plot.