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 at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: RE: Overlaying an unknown number of line graphs


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: Overlaying an unknown number of line graphs
Date   Wed, 9 Nov 2011 11:15:09 +0000

Of course, it is likely to be a mess! For n up to 25, using separate graphs and -graph combine- can be as good or better. Depends... 

Nick 
n.j.cox@durham.ac.uk 


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Colin Robert Angus
Sent: 09 November 2011 11:10
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: RE: Overlaying an unknown number of line graphs

Nick & Antoine,

That's exactly what I needed,

Thanks,

Colin

Nick Cox said the following on 09/11/2011 10:58:
> It's a loop:
>
> local n = whatever 
>
> forval i = 1/`n' { 
> 	local call `call' (line freq`i' sample`i', sort)  
> } 
>
> twoway `call'
>
> You might to suppress the -legend()-. 
>
>
> Nick 
> n.j.cox@durham.ac.uk 
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Colin Robert Angus
> Sent: 09 November 2011 10:48
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Overlaying an unknown number of line graphs
>
> Dear list,
>
> I am writing a do file to take n random samplings from a distribution, 
> for a user-inputted value of n.
> This file creates variables labelled sample`i' and freq`i' for each 
> value of i between 1 and n.
> I would like to draw a single line graph with all of the plots of 
> sample`i' against freq`i' overlaid on it.
> So something like:
> twoway (line freq1 sample1, sort) (line freq2 sample2, sort)...(line 
> freqn samplen, sort)
> But I can't see how to write this without knowing the value of n 
> beforehand, and then, if n is large, writing an incredibly long command.
> Is there a way to do this within Stata?
>
>
> *
> *   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/
>   

-- 
Colin Angus
Research Assistant
Health Economics and Decision Science
School of Health and Related Research (ScHARR)
University of Sheffield

Address:
    ScHARR, Regent's Court
    30 Regent St
    SHEFFIELD S1 4DA
    United Kingdom

Tel: +44 (0)114 222 0686
Fax: +44 (0)114 272 4095
URL: www.shef.ac.uk/heds
E-mail address: C.R.Angus@sheffield.ac.uk 

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

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