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: graph bar - how to add 'external' label above stacked bar chart
From
Phil Clayton <[email protected]>
To
<[email protected]>
Subject
Re: st: graph bar - how to add 'external' label above stacked bar chart
Date
Thu, 17 Feb 2011 10:45:00 +1030
I'm sure others have better suggestions but 2 options include:
1. use -twoway bar- instead of -graph bar-, and scatter C against the group with
invisible markers labelled with their value
2. draw the bar graph without the labels, then invoke the Graph Editor to add the
labels manually (requires more programming):
_gm_edit .graphname.plotregion1.barlabels[1].text.Arrpush C1 %
_gm_edit .graphname.plotregion1.barlabels[2].text.Arrpush C2 %
...
graph display graphname
Phil
On Thu 17/02/11 10:40 , Vianney [email protected] sent:
> Dear STATA users,
>
>
> I am trying to create a stacked bar chart that graphs 2 volumes (say
> variables 'A' & 'B'), but that also includes a label on top of each
> bar. This label, however, is neither variable `A' nor `B', but a third
> piece of information, 'C'
>
> Specifically, it would appear that the option blabel() is not
> appropriate here, as my variable 'C' is NOT:
>
> * the bar height
> * the cumulative bar height
> * the name of yvar
> * the name of the first over() group
>
> > It's actually a percentage value that is in my
> dataset, where C = (B/(A+B))> How would I modify the STATA command below to
> add 'C' as a label on top of each stacked bar?
> #delimit ;
> graph bar (sum) A B, over(yearnum) over(country) stack
> ;
> #delimit cr
>
>
> Many thanks for your help!
>
> Best,
> Vianney
> *
> * 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/