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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: FW: Scatterplot Axis with non-ordinal range |

Date |
Sun, 23 May 2004 16:49:26 +0100 |

Daniel Egan > Heres one for graphing masters: > > How would I make a graph (scatterplot or connected) with the x-axis > going from 19-23, then 0-7. I am tracking hourly outcomes overnight, > and so want to be able to graph from 1900 (7pm) to 0700 (7 am). > My x (hour) values range from 0 to 23. > > As it stands, my command looks like: > > twoway (connected aarhc hour if createdby=="ba") > (connected aarhc hour if createdby=="de") > (connected aarhc hour if createdby=="kl") > (connected aarhc hour if createdby=="aw") > (connected aarhc hour if createdby=="lt") > (connected aarhc hour if createdby=="is") > if sd==0, legend(position(12) ring(0)) > > so if possible, I would like to be able to include the range option > in the "twoway (...)(...) , range(??)" option. > > The range option does not seem to support a numlist type format, > i.e. I have tried > > r(19 20 21 22 23 0 1 .....) ... > -r()- is for specifying axis minimum and maximum and does not help with this problem. In essence you must specify to Stata a variable which is increasing from one end to the other of your time axis. So something like this is needed gen Hour = cond(hour < 12, hour + 24, hour) Now all that you need is show values of -hour- as text labels for values of -Hour-. If you need at most integer hours, you could do something like this foreach h of num 0/24 { local H = cond(`h' < 12, `h' + 24, `h') label def Hour `H' "`h'", modify } or this foreach h of num 0/24 { local H = cond(`h' < 12, `h' + 24, `h') label def Hour `H' "`h':00", modify } and label val Hour Hour Alternatively, doing it on the fly may be as efficient: twoway (connected aarhc Hour if createdby=="ba") ... if sd==0, legend(position(12) ring(0)) xla(17 "17:00" ... 25 "1:00" 26 "2:00" ...) where you must fill the ... yourself. * * 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/

- Prev by Date:
**st: RE: re: dta file not stata format** - Next by Date:
**st: RE: RE: RE: treatment of "$" in graphics text** - Previous by thread:
**st: RE: re: dta file not stata format** - Next by thread:
**st: RE: RE: RE: treatment of "$" in graphics text** - Index(es):

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