Bookmark and Share

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


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

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


From   Rob Ploutz-Snyder <[email protected]>
To   [email protected]
Subject   Re: st: only display top 5 results in pie graph
Date   Wed, 18 Apr 2012 09:59:59 -0500

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 <[email protected]> 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 <[email protected]> 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:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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