| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Re: Arbitrary limits on number of data series for line plots
From |
"Michael Blasnik" <[email protected]> |
To |
<[email protected]> |
Subject |
st: Re: Arbitrary limits on number of data series for line plots |
Date |
Thu, 27 Apr 2006 07:53:57 -0400 |
Based on your example graph commands (identical line styles and symbols for
all lines), wouldn't it work to reshape long and then use the connect(L)
option after sorting by panel and date? Also, -xtline- may be worth
checking out, although I'm not sure what it's limitations may be with more
than 100 panels.
Michael Blasnik
[email protected]
----- Original Message -----
"Allan Reese (Cefas)" <[email protected]> wrote:
Hi Stata plotters
I have data in which numerous individuals were each observed for a short
time. It makes sense to plot each individual against time, so the data
have been restructured with observations for each date and a response
variable for each individual:
day y1 y2 y3 ...
1 v . .
2 v . .
3 v v v
4 v v v
5 v . v
6 v . v
7 . . v
(v where there was an observation, and the days extend over several
years.)
From such data it is easy to plot several lines on one plot:
scatter y1-y3 day, c(l l l l) ms(i i i i)
The extra items in the connect and symbol lists are ignored, which is
fortunate as I might use "y1-y20" where some individuals have been dropped
so the actual number of variables is not obvious.
The first limit was hit at 20 y series. I can't find in the documentation
a limit for the varlist in a scatter command. I recall it used to be
about 29 y variables. The command
scatter y1-y25 day, legend(off) pcycle(1)
appears to work. The options are only to avoid a multicolored plot
squashed by a huge legend.
More points appear on each plot of y1-y15, y1-y20, y1-y25 so it appears
all series are plotted.
However
scatter y1-y21 day, c(l l l l l l l l l l l l l l l l l l l l l )
ms(i i i i i i i i i i i i i i i i i i i i i )
legend(off) pcycle(1)
does NOT work. Having more than 20 items in the option lists appears to
crash some buffer, and the plot reverts to default markers.
BUG? It appears the varlist can have more than 20 y variables, but the
connect list can have only 20 items. (The style list recycles after 15
but I haven't tried extending that.)
Since I had more than 20 individuals, the next step was to overlay
scatterplots:
scatter y1-y20 datevar, c(L L L L L L L L L L L L L L L L L L L
)
ms(i i i i i i i i i i i i i i i i i i i i )
|| scatter y21-y40 datevar, c(L L L L L L L L L L L L L L L L L
L L L )
ms(i i i i i i i i i i i i i i i i i i i i )
|| scatter y41-y60 datevar, c(L L L L L L L L L L L L L L L L L
L L L )
ms(i i i i i i i i i i i i i i i i i i i i )
|| scatter y61-y80 datevar, c(L L L L L L L L L L L L L L L L L
L L L )
ms(i i i i i i i i i i i i i i i i i i i i )
|| scatter y81-y100 datevar, c(L L L L L L L L L L L L L L L L
L L L L )
ms(i i i i i i i i i i i i i i i i i i i i ) pcycle(1)
legend(off) xlab(,angle(20)) ylab(,angle(0))
And that (copied from the log) works. But add one more "|| scatter y101
datevar" and get the error message "Too many variables specified". 100
variables may have seemed a generous limit when programmed, but can anyone
suggest a method to draw more lines on the same graph?
Allan
*
* 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/