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
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: only display top 5 results in pie graph
Date
Mon, 16 Apr 2012 20:01:08 +0100
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/