Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: adding lines to graph


From   "Clara Soh" <[email protected]>
To   <[email protected]>
Subject   RE: st: adding lines to graph
Date   Tue, 20 May 2003 14:37:26 -0400

thanks to everyone who replied.  I didn't even know where to start looking.  I have another question, maybe you can oblige me with some more help.  having successfully added the lines to my graph, I am now trying to shade only certain sections of the background.  for example, not only did I want to include a line for sept 11, but I want to also shade the entire region of the graph from Feb 2001 to May 2003 to indicate that the economy is in recession.  the only option for shading would shade the entire plot region, not just certain sections.  or I cannot figure out how to constrain the plot area shading to only part of the graph.  

thanks again
clara



>>> [email protected] 05/20/03 02:27PM >>>
At 11:36 20/05/03 -0400, Eldin Leighton
  wrote:
>To find the actual integer that corresponds to 9/11/2001, enter the command:
>
>display mdy(9,11,2001)
>
>Now, I believe you will get a vertical line plotted on your graph if you
>include
>
>xline(15229)
>
>since 15229 is the "date" integer corresponding to the date 9/11/2001.
>
>Hope this helps.
>Eldin


A package that might also help is my own -datelist-, downloadable from SSC. Type -ssc desc datelist- to find out more. -datelist- returns a list of 
dates in the return macro r(numlist), which the user may then use as a 
-xlabel- option in a -graph- command.

For instance, if -date- is a date variable, and -y- is another variable 
which varies with time, and the user wants an axis label at the first day of each month from 1 January 1999 to 1 Januart 2000, then s/he might type

datelist,fi(01/01/1999) la(01/01/2000) s2(mdy) unit(month)
graph y date,xlabel(`r(numlist)')

I hope this helps.

Roger


>-----Original Message-----
>From: [email protected] 
>[mailto:[email protected]]On Behalf Of Neil Shephard
>Sent: Tuesday, May 20, 2003 10:44 AM
>To: [email protected] 
>Subject: Re: st: adding lines to graph
>
>
>clara wrote...
> > I have a data set over a ten year period, and created a simple line graph
>to show the trend.  however, i want to add in vertical lines at certain time
>points to indicate when specific events occured that explain why the trend
>is moving a certain way.  for example, i want to add a line for
>september 11, to explain why employment might have dropped so drastically.
>
>This is for Stata 7.....
>
>man grsym
>
>reveals that you can add horizontal lines using yline and rline whilst
>vertical lines can be drawn using xline and tline.
>
>Hope thats of some help
>
>Neil
>
>Neil Shephard
>Genetics Statistician
>ARC Epidemiology Unit, University of Manchester
>[email protected] 
>[email protected] 
>
>"Contrariwise, if it was so, it might be; and if it
>were so it would be; but as it isn't, it ain't. That's
>logic" - Tweedledee (Alice Through the Looking Glass)
>*
>*   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/ 
>
>*
>*   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/ 


--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
   or 020 7848 6605 International +44 20 7848 6605
Email: [email protected] 

Opinions expressed are those of the author, not the institution.

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


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



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