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: create a legend for a pie chart with a single obs line


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: create a legend for a pie chart with a single obs line
Date   Wed, 2 May 2012 21:26:33 +0100

You may just need -legend(on)-.

Some technique is shown here:

clear
set obs 1
gen x = 42
graph pie , over(x) legend(on order(- "100% of everything"))


On Wed, May 2, 2012 at 9:16 PM, tashi lama <[email protected]> wrote:

>   When I have a dataset like following,
>
> hits    id
>
> 2        A
> 3        B
> 4        C
>
> graph pie hits, over(id) plabel(_all percent)   would give me a pie chart with percent slices and a legend labels A, B and C. But say, if I have only one line of obs and I still want a pie chart, I will get a pie chart, a slice labelled 100% but without legend.
>
> Is there a way to get a legend even if there is only one single observation like following
>
> hits   id
>
> 2       A
>

> and I say, graph pie hits, over(id) plabel(_all percent)

*
*   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