Statalist The Stata Listserver

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

st: RE: Thanks re: Arbitrary limits on number of data series for line plots

From   "Nick Cox" <>
To   <>
Subject   st: RE: Thanks re: Arbitrary limits on number of data series for line plots
Date   Fri, 28 Apr 2006 18:30:36 +0100

Your graph would seem obtainable by 

linkplot y day, link(id) c(L) 


Allan Reese
> Thanks to Nick Cox for drawing my attention to "help 
> stylelists".  That will save a lot of typing in future.
> Michael Blasnik is right that plotting these graphs from the 
> long format data is a better solution.  I've tried that in 
> the past, and failed because data were not sorted correctly 
> or there might be single points.  In these data each 
> individual was necessarily observed over a series of days, so 
> the data can be reverse-sorted by the start-date for each 
> individual, then forward-sorted on the individual's dates.  
> c(L) then works fine.
> Long data has vars id, day, y
> egen minday= min(day), by(id)
> gsort  -minday day
> scatter y day, c(L) ms(i)
> Wow, that's saved some typing!  Thanks.
> I'd got in the habit of structuring data wide (multiple 
> variables) so that different variables (subsets) could be 
> distinguished. It's also easier to stick with scatter, rather 
> than use other specialist commands and look up which options 
> are allowed with each.  There are other ways of doing the following:
> gen malewt = weight if sex=="M"
> gen femwt = weight if sex=="F"
> gen vbig = weight>100
> scatter malewt femwt vbig day, c(l l .) ms(i i t) mlab(. . id)
> Thanks to Vince Wiggins for technical background.  In the 
> immediate application, finding the limit of 100 lines just 
> helped me decide the data fell naturally into subsets, with 
> fewer than 100 individuals in each. So no problem in waiting 
> for future updates ;-)  As Vince points out, if there's a 
> limit, some fool will try to bend it.

*   For searches and help try:

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