Simple marimekko/mosaic plots

I don’t really care for the name “marimekko” or “mosaic,” but I do like this type of plot as a means of illustrating proportions in nested categorical data, or as an alternative to the parallel time series plots discussed here (see this rather amateurish example).

The Gist below is my attempt to make these somewhat complicated plots as simple as possible (here is another worthwhile approach). One problem that I run into when producing these mosaic plots is that every one seems different, but I have attempted to distill each box into four consistent parameters, and I include two distinct data examples.

By d-sparks

Tags: rstats graphics vcd ggplot2 RColorBrewer