Statalist The Stata Listserver

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

Re: st: Arbitrary limits on number of data series for line plots

From (Vince Wiggins, StataCorp)
Subject   Re: st: Arbitrary limits on number of data series for line plots
Date   Thu, 27 Apr 2006 11:23:22 -0500

Allan Reese <> notes that you can specify at most 20
styles in the stylelist of a twoway graph option.

>     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) [...]
> does NOT work.  Having more than 20 items in the option lists [...]

This is indeed an undocumented limit.  We did not think anyone was likely to
hit the limit (and there's an assumption that invariably turns out to be
wrong), but it will be documented.

Michael Blasnik <> suggested that Allan reshape his
data to long format.  I agree that this is the best approach for Allan's data,
but he could also just type

>     . line y1-y21 day, pcycle(1)

and get same results without the need for all of the connect and marker symbol

Allan also notes that he is limited to plotting 100 variables.  

Not that it matters to Allan, but the limit is imposed by -serset-, which
-twoway- uses to store its data.  -serset- is limited to 100 variables.  

One way around this is to convince -twoway- that it needs to create multiple
sersets, and we can do that by deceiving it into believing that the plots are
using different sets of observations.

For example,

     . set obs `=_N+1'
     . twoway line y1-y80 x || line y81-y160 x if x != .

Because x is missing in our added observation, the effective observations are
the same for both plots, but -twoway- does not know that and assumes that two
sersets must be created.

If Allan can wait until the next ado update, he will not need to deceive
-twoway-.  After the next update, -twoway- will take care not to combine the
sersets for plots it those sersets would exceed 100 variables.  Each plot
specification, however, remains limited to 100 variables.

-- Vince

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index