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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: RE: RE: multiple lines on one graph using foreach


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: multiple lines on one graph using foreach
Date   Tue, 16 Mar 2010 21:13:34 +0100

<>

"-xtline- then offers one solution"


Example: http://www.stata.com/statalist/archive/2009-11/msg01132.html



HTH
Martin


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: Dienstag, 16. März 2010 21:11
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: multiple lines on one graph using foreach

If you declare your data as panel data, -xtline- then offers one solution.
There are other solutions. Do you want each individual to be identifiable as
such? It is all too easy in that case to produce a legend almost as big as
the graph. 

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

Robert Song

I would like to use a foreach statement to graph ~10 different lines on a
 single graph. But each time I do this using code below,  I generate 10 
separate graphs. Any one know how I can do this? Also how can I generate
 a best fit line and 95% interval? I did this out longhand and it 
works... but there are a handful of graphs I need to make and it gets 
tedious.

foreach ID in 1111 1112 1113 1114 1115 1116 1117 1118 
1119 1120 1121 1122 
{
twoway line temperature time if 
animalnumber == `ID' 
}


*
*   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