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]

st: (Many) overlaid graphs


From   Maria Ana Vitorino <vitorino@wharton.upenn.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: (Many) overlaid graphs
Date   Thu, 19 May 2011 17:11:42 -0400

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!

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