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]

From |
Joerg Luedicke <joerg.luedicke@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: (Many) overlaid graphs |

Date |
Thu, 19 May 2011 18:06:20 -0400 |

On Thu, May 19, 2011 at 5:11 PM, Maria Ana Vitorino <vitorino@wharton.upenn.edu> wrote: > Dear Statalist users, > > I'm trying to do multiple overlaid graphs but I'm not sure how to do it > since I have a very large number of time series. > The data is the following: > > > +------------------------+ > | Person Weight Date | > |------------------------| > 1. | Name1 50 1 | > 2. | Name1 55 2 | > 3. | Name1 50 3 | > 4. | Name1 45 4 | > 5. | ... . . | > |------------------------| > 6. | Name2 85 2 | > 7. | Name2 88 4 | > 8. | Name3 68 1 | > 9. | ... . . | > 10. | .. . . | > |------------------------| > 11. | NameN . . | > +------------------------+ > > If I just wanted to do the plot for the first two people, I could use > something like: > > twoway (scatter weight date if Person=="Name1", connect(l) sort xlab(, > valuelabel) legend(label(1 "Name1"))) (scatter weight date if > Person=="Name2", connect(l) sort xlab(, valuelabel) legend(label(2 > "Name2"))) > > > But, what I am trying to achieve is a plot with lines for ALL the people in > the dataset. Since there are many people it is cumbersome to add one plot > per person manually. > > Is there an easier way of doing the plot with all the series in the same > graph (and with a legend saying which series refers to each person)? > > Thanks for the help! One straightforward way of doing that would be: xtline Weight , overlay i(Person) t(Date) You do not need the i and t specification if you xtset your data (-help xtset-, but in which case your id variable would not be allowed to be a string variable). J. * * 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/

**References**:**st: (Many) overlaid graphs***From:*Maria Ana Vitorino <vitorino@wharton.upenn.edu>

- Prev by Date:
**Re: st: RE: Which test to use?** - Next by Date:
**Re: st: nlsur QUAIDS (Poi 2008)** - Previous by thread:
**st: (Many) overlaid graphs** - Index(es):