Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Bar labels in stacked bar chart


From   Friedrich Huebler <huebler@rocketmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: Bar labels in stacked bar chart
Date   Mon, 12 Apr 2004 10:13:12 -0700 (PDT)

I found a simple answer to my question. -catplot- can create the same
graph as -graph bar- after the data has been recoded.

. recode rep78 3=1 4=2 5=3 1=4 2=5
. catplot bar rep78 foreign, percent(foreign) asyvars stack

Friedrich Huebler

--- Friedrich Huebler <huebler@rocketmail.com> wrote:
> Nick,
> 
> Thank you, -catplot- is easier to use than -graph bar- because
> several steps can be skipped. Another advantage is that -catplot-
> works with numeric values and strings.
> 
> However, with -graph bar yvars, over(varname) stack- it is possible
> to stack the bars in a specific order by varying the order in which
> the yvars are listed.
> 
> . sysuse auto
> . tab rep78, gen(rep)
> . graph bar rep3 rep4 rep5 rep1 rep2, over(foreign) stack percent
> 
> Can the same be accomplished with -catplot-?
> 
> Thank you.
> 
> Friedrich Huebler
> 
> --- Nick Cox <n.j.cox@durham.ac.uk> wrote:
> > Another way to do it is (in total) 
> > 
> > . catplot bar rep78 for , percent(for)  asyvars stack 
> > 	blabel(bar, pos(center) format(%3.2f))
> > 
> > where I've added a format control. Here -catplot- can be 
> > installed from SSC.

__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index