# How to visualize counts of different categories

Suppose we have $10$ boxes and we are interested in measuring the number of apples, oranges and pears in each. What is a good way to visualize how the boxes relate to each other in terms of the distribution of fruits? For example, box 1 might have 5 apples, 10 oranges, and 6 pears while box 10 might have 1 apple, 1 orange and 1 pear.

Added. Is looking at a distance matrix appropriate? Is there a way to visualize a distance matrix?

• With numbers so small, why is a table a bad option? – AdamO Apr 12 '13 at 20:48
• A table could work fine too. – Nick Cox Apr 12 '13 at 23:51

What about a spineplot? That way you can simultaneously display both the differences in proportions per box and differences in the size of the boxes. Your example with two boxes would look like this:

• Can you make spine plots in SPSS? – guestoiejroe Apr 12 '13 at 16:34

I agree broadly with Maarten, as a click on his link will imply, but other answers are possible.

Note first that many people would regard a spineplot as just a special case of a mosaic plot. Programs or functions in your favourite software are perhaps more likely to use the second term.

That said, a good old-fashioned bar chart or (Cleveland) dot chart can work as well here as anything else, although some designs are better than others. In particular, stacked (divided) bar charts divide the world: some love them, some hate them.

Pie charts? Just say no.

Yet further, your question leaves open quite what you want your graph to show. Do you want to emphasise frequencies or to emphasise proportions or (quite reasonably) to have it both ways? The spineplot implementation in Stata used by Maarten can show absolute numbers as well as conveying the fractional breakdown, and that's surely a standard feature in other environments.

• Can you do it in SPSS? – guestoiejroe Apr 12 '13 at 16:32
• Sorry, haven't used SPSS for about 30 years. Someone else may know. – Nick Cox Apr 12 '13 at 16:42
• Poster asked about whether a distance matrix would be useful. Depends on the problem and what kind of distance matrix. Your question is about visualizing a two-way table of counts. If you have some other question in mind, best to give us much more background. – Nick Cox Apr 12 '13 at 16:45
• SPSS has no native implementation of the spineplot @guestoiejroe (unfortunately there is no magical "Mosaic" coordinate system as Wilkinson displays in his Grammer book). I would suggest piggy-backing on the R vcd library (that is calling R code from SPSS). While I am here though, I was working on an implementation of one the other day in SPSS, so a question to Dr. Cox - how do you do your default ordering of the categories? – Andy W Apr 12 '13 at 16:49
• @Nick Cox: I want to see how similar a box is to another box. So it seems that using a Euclidean distance similarity matrix would be good. – guestoiejroe Apr 12 '13 at 16:52