Skip to content

Mosaicplot with different colors

2 messages · Jan Sabee, Achim Zeileis

#
This dataset below is one sample answer the questioner from our customer.
age married income gender ownhouse class
1  20-30      no   high female      yes   1st
2  30-40      no   high female      yes   1st
3  40-50      no    low female      yes   1st
4  50-60      no   high female      yes   1st
5  60-70      no   high female      yes   1st
6  20-30      no   high female      yes   1st
7  20-30      no medium female      yes   1st
8  20-30      no    low female      yes   1st
9  20-30      no   high   male      yes   1st
10 20-30      no   high female      yes   1st
11 30-40      no   high female      yes   1st
12 40-50      no   high female      yes   1st
13 50-60      no medium female      yes   1st
14 20-30      no medium female      yes   1st
15 20-30      no    low female      yes   1st
16 20-30      no   high   male      yes   1st
I know mosaicplot (package vcd) can handle for this dataset.
I want to plot that dataset which different colors for age, income and gender.
How can I do that? Or are there any others package?
Thanks in advance for any assistance.

Jan Sabee
#
On Tue, 29 Mar 2005, Jan Sabee wrote:

            
You don't see very much in that plot, do you? 16 observations is not too
much for 6-way information.
Do you want to have a color code which codes all three variables at the
same time? I wouldn't have a straightforward solution for that. But if you
want to shade with respect to a single variable, that might be possible.
You can use
  mosaicplot(mytable, col = ...)
and shade with respect to the last margin added.
We have a much more flexible implementation of mosaicplots (written in
grid) which will (hopefully) soon be released that allows the
specification of arbitrary color patterns in mosaicplots. If you're
interested, contact me offlist and we'll send you a devel-snapshot.
Z