Statalist


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

Re: st: Overlay connected line onto bar graph


From   Ronnie Babigumira <rb.glists@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Overlay connected line onto bar graph
Date   Tue, 29 Sep 2009 17:09:44 +0700

Dear Martin and Maarten

Just what I needed. Many thanks.

Ronnie

Maarten buis wrote:
--- On Tue, 29/9/09, Ronnie Babigumira wrote:
I am trying, without much luck, to re-create a chart a
colleague has produced in MS Excel. The data are
<snip>

The trick is that you can "stack" different -twoway- graphs
on top of one another, like in the example below:

*-------------- begin example -------------
clear
input quintile     total       afi   rfi
             1   1096.83    717.27   .44
             2    4045.8   1430.88   .35
             3   5741.28    1747.3    .3
             4   9429.86   2414.48   .27
             5   19040.5   4688.59   .27
end

gen xtot = quintile - .2
gen xafi = quintile +.2
twoway bar total xtot, barw(.40) || ///
       bar afi xafi, barw(.4)    || ///
       line rfi quintile ,yaxis(2)  ///
       ylab(0(.1).5, axis(2))
*------------- end example --------------------
(For more on examples I sent to the Statalist see: http://www.maartenbuis.nl/example_faq )

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------



Send instant messages to your online friends http://uk.messenger.yahoo.com
*
*   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   |   What's new   |   Site index