Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

RE: st: RE: How to stack bars?


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: How to stack bars?
Date   Thu, 15 Mar 2012 14:02:32 +0000

Good. It's tacit in my proposal that VAR1 and VAR2 are both >= 0. 

Nick 
n.j.cox@durham.ac.uk 

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of oezguer.guererk@uni-erfurt.de
Sent: 15 March 2012 13:59
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: RE: How to stack bars?

Thank you! It works!

Am 15.03.2012 12:52, schrieb Nick Cox:
> You can't stack this way, but you can simulate stacking.
>
> If you define
>
> clonevar total = VAR2
> replace total = VAR1 + VAR2
>
> you can then superimpose the bars for -VAR1- on top of those for -total-.
>
> twoway (bar total period, yaxis(2)) (bar VAR1 period, yaxis(2))
> (scatter VAR3 period) (scatter VAR4 period), by(VAR5 VAR6)
>
> Warning: not tested.
>
> Defining -total- as VAR2 in the first instance with -clonevar- ensures that it inherits any variable label for VAR2, which can help in graph legends.
>
> Alternative: Look at -rbar-.
>
> Nick
> n.j.cox@durham.ac.uk
>
> oezguer.guererk@uni-erfurt.de
>
> How can I stack the bars (VAR1 and VAR2) in the following command?
>
> . twoway (bar VAR1 period, yaxis(2)) (bar VAR2 period, yaxis(2))
> (scatter VAR3 period) (scatter VAR4 period), by(VAR5 VAR6)
>
>
> *
> *   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/

-- 
Dr. Özgür Gürerk

Lst. für Mikroökonomie&  Laboratorium für experimentelle Wirtschaftsforschung (eLab)
Microeconomics&  Laboratory for Experimental Economics (eLab)

Universität Erfurt, Nordhäuser Str. 63, D-99089 Erfurt

Tel: +49 361 7374561
Fax: +49 361 7374569
www.uni-erfurt.de/elab
--

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index