Dear R users, I remember seeing somewhere a method of visualizing a set of observations on two variables x and y in the following way x=0 x=1 |-------| |-------| y=-1 | | | | |-------| | | | | |-------| | | | | |-------| y=0 | | | | |-------| |-------| | | |-------| |-------| y=1 | | |-------| |-------| |-------| where x = 0 or 1; y = -1, 0, 1. The 'tile' area represents the count of observations with corresponding x and y values. Now, I don't remember what is the name of the functions that support such plots. I tried help.search("*tile*"); I skimmed the documentation of the 'lattice' package. Both seem not to be what I remembered. Please send me pointers. Thanks in advance Itay
> > Dear R users, > > I remember seeing somewhere a method of visualizing a set of > observations on two variables x and y in the following wayIs this what you want?> ## fake data > zz <- data.frame(x=sample(0:1,20,rep=T),y=sample((-1:1),20,rep=T)) > zz> ## tabulate it > zz.tab <- data.frame(table(zz)) > zz.tab > library(lattice) > barchart(y ~ Freq | x, data=zz.tab)Cheers Jason
Whoops - didn't get what you meant ?mosaicplot is your friend Cheers Jason
Thanks, but no. In the method that I remember the plot was an assortment of oblong(?) tiles, optionally color coded, and filling a square region. According to my recollection it was possilbe to add more variables, in which case each tile is broken down further into sub-tiles. Itay On Wed, 14 Apr 2004, Jason Turner wrote:> > > > Dear R users, > > > > I remember seeing somewhere a method of visualizing a set of > > observations on two variables x and y in the following way > > Is this what you want? > > > ## fake data > > zz <- data.frame(x=sample(0:1,20,rep=T),y=sample((-1:1),20,rep=T)) > > zz > > > ## tabulate it > > zz.tab <- data.frame(table(zz)) > > zz.tab > > library(lattice) > > barchart(y ~ Freq | x, data=zz.tab) > > Cheers > > Jason >