Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: only display top 5 results in pie graph

From   Nick Cox <>
Subject   Re: st: only display top 5 results in pie graph
Date   Wed, 18 Apr 2012 16:18:06 +0100

I am not fond of pie charts, but there is a partial defence.

1. They are so familiar to many audiences that they will go down easily.

2. People tend to be quite good at some comparisons, particularly if
pie slices are about 50% or about 25%. This may be a side-effect of
hungry meal-times when young or when sharing dessert with Stata

Naturally, there are negatives, including

3. You should be so lucky that your data are so simple. It's all too
common to have lots of small slices and decoding relative or absolute
sizes is then hard work. Bar charts work better.

4. Multiple pie charts usually don't work at all. You are supposed to
compare slice by slice???

5. Even with a single pie chart there is often not enough space to
avoid an awkward multicolour display and a legend. In principle people
know that they can go back and forth between legend and pie, but
usually don't bother.

If you haven't met it before: the rule let one child cut and the other
choose the first slice is a good one. No graphical application though.


On Wed, Apr 18, 2012 at 3:59 PM, Rob Ploutz-Snyder
<> wrote:
> I couldn't agree more with Nick on favoring a bar chart over a pie
> chart.  I see no use for pie charts, unless the slices are made of
> real pie, and it's at the dinner table..
> "I'll take that slice of cheese cake over there please.  Yes--the one
> representing about 15% of the whole..."
> Sorry.. just had to do it.
> Rob
> On Mon, Apr 16, 2012 at 2:01 PM, Nick Cox <> wrote:
>> My main suggestion is that you would be better off with a horizontal
>> bar chart, which would show 20 or so bars without much difficulty,
>> quite apart from other advantages.
>> That said, some technique can be gleaned from this example.
>> sysuse auto, clear
>> collapse (sum) price-foreign
>> xpose, clear varname
>> gsort -v1
>> graph pie v1 in 1/5, over(_varname) sort
>> su v1
>> local sumall = r(sum)
>> su v1 in 1/5
>> replace v1 = `sumall' - r(sum) in 6
>> replace _varname = "others" in 6
>> graph pie v1 in 1/6, over(_varname) sort
>> Nick
>> On Fri, Apr 13, 2012 at 4:43 PM, tashi lama <> wrote:
>>       I have a dataset containing 15 variables. When I draw a pie
>> chart, it looks really messy because of large no of variables. Does
>> anyone have any idea to have a pie chart displaying only the top 5
>> results? Rank is total values of observations. Thanks in advance..

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index