[R] squared "pie chart" - is there such a thing?

Sarah Goslee sarah.goslee at gmail.com
Thu Jul 21 19:02:08 CEST 2011


On Thu, Jul 21, 2011 at 12:33 PM, Dimitri Liakhovitski
<dimitri.liakhovitski at gmail.com> wrote:
> Thanks a lot, Sarah.
> I am definitely going to explore.
> A quick question about
> mosaicplot(matrix(c(50, 30, 20, 0), 2, 2))
> mosaicplot(matrix(c(0, 50, 20, 30), 2, 2))
>
> What are the numbers that appear on the graphs (2.1, 2.2,1.1,1.2)?
> Dimitri
>

mosaicplot() actually expects a contingency table, so those are the
purported group memberships. The resulting boxes are proportional to
the cells, which is what you wanted, even though you aren't using it
in the intended way. That's also why there's a mark to show the 0 cell
in the matrix.

Where mosaicplot() starts to really become interesting is when you
have multiple-dimension contingency plots. But for your purpose, you
can just have a two-dimensional matrix of numbers, and mosaicplot()
will draw a corresponding set of proportionally-sized rectangles.

Sarah

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list