Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I have a data like this:

> table(A,B,C)
, , C = FALSE

       B
A       FALSE TRUE
  FALSE   177   42
  TRUE      6    8

, , C = TRUE

       B
A       FALSE TRUE
  FALSE     5   31
  TRUE      4   10

How can I plot this on a single graph, possibly without imposing any hierarchy?

share|improve this question
add comment

2 Answers

up vote 14 down vote accepted

I would try some kind of 3D heatmap, mosaic plot or a sieve plot (available in the vcd package). Isn't the base mosaicplot() function working with three-way table? (at least mosaic3d() in the vcdExtra package should work, see e.g. http://datavis.ca/R/)

Here's an example (including a conditional plot):

A <- sample(c(T,F), 100, replace=T)
B <- sample(c(T,F), 100, replace=T)
C <- sample(c(T,F), 100, replace=T)
tab <- table(A,B,C)
library(vcd)
sieve(tab, shade=TRUE)
cotabplot(tab)
library(vcdExtra)
mosaic3d(tab, type="expected", box=TRUE)

alt text

alt text

alt text

Actually, the rendering of mosaic3d() rely on the rgl package, so it is hard to give a pretty picture of the result.

share|improve this answer
1  
+1 this is neat, I'd forgotten about the vcdExtra package. –  ars Nov 4 '10 at 20:01
    
Very nice list chl - thank you! –  Tal Galili Nov 4 '10 at 23:40
add comment

I recently came across a paper by Hadley Wickham and I was reminded of this question (I must spend too much time on the site!)

Wickham, Hadley and Heike Hofmann. 2011. Product plots. IEEE Transactions on Visualization and Computer Graphics (Proc. Infovis `11). Pre-print PDF

Abstract

We propose a new framework for visualising tables of counts, proportions and probabilities. We call our framework product plots, alluding to the computation of area as a product of height and width, and the statistical concept of generating a joint distribution from the product of conditional and marginal distributions. The framework, with extensions, is sufficient to encompass over 20 visualisations previously described in fields of statistical graphics and infovis, including bar charts, mosaic plots, treemaps, equal area plots and fluctuation diagrams.

I know it is typical to try to give greater explanation, but I don't think I can do any better job than the abstract and posting some pictures! The novel examples they present in the right most images (I believe) meet your requirements without imposing a hierarchy.

enter image description here

share|improve this answer
1  
(+1) Nice finding! –  chl Jan 10 '12 at 20:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.