Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Twoway graphs


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Twoway graphs
Date   Tue, 4 Dec 2007 12:27:00 -0000

You need not apologise. Either your question is fair, as I believe it 
is, or you just shouldn't send it. 

twoway line u5mr20-u5mr40 year, lcolor(red ..) 

is how I would start your example. That carries an assumption about 
order of variables in your dataset. 

Nick 
[email protected] 

Honorati Masanja

Apologies for bothering you with another trivial question. I would like 
to run code to draw the following twoway graphs on the same graph. I 
have an example of code I've written but this goes up to 100!

#delimit ;
twoway (line u5mr20 year,lcolor(red))
       (line u5mr21 year,lcolor(red))
       (line u5mr22 year,lcolor(red))
       (line u5mr23 year,lcolor(red))
       (line u5mr24 year,lcolor(red))
       (line u5mr25 year,lcolor(red))
       (line u5mr26 year,lcolor(red))
       (line u5mr27 year,lcolor(red))
       (line u5mr28 year,lcolor(red))
       (line u5mr29 year,lcolor(red))
       (line u5mr30 year,lcolor(red))
       (line u5mr31 year,lcolor(red))
       (line u5mr32 year,lcolor(red))
       (line u5mr33 year,lcolor(red))
       (line u5mr34 year,lcolor(red))
       (line u5mr35 year,lcolor(red))
       (line u5mr36 year,lcolor(red))
       (line u5mr37 year,lcolor(red))
       (line u5mr38 year,lcolor(red))
       (line u5mr39 year,lcolor(red))
       (line u5mr40 year,lcolor(red))
       (scatter u5m2 year),
       xlabel(1990(5)1920) ylabel(0(20)200);
#delimit cr


I tried  the code below but I get separate graphs

foreach var of varlist u5mr20-u5mr40 {
    twoway (line `var' year)  (scatter u5m year,), xlabel(1990(5)1920) 
ylabel(0(20)200)
}

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index