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

st: Re: graphing and shading


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: graphing and shading
Date   Tue, 3 Jun 2003 19:35:57 -0500

----- Original Message ----- 
From: "John D. Levendis" <john-levendis@uiowa.edu>
To: "statalist" <statalist@hsphsun2.harvard.edu>
Sent: Monday, June 02, 2003 9:28 PM
Subject: st: graphing and shading


> Hi everyone,
>
> I've got a quation regarding the new graphing facilities in STATA8.
>
> Lets say I've got some GDP data over time. Stata provides a means whereby
I can
> demarcate a year using xline. Thus, I could show the great depression as
the
> area between two vertical lines:
> - twoway connected gdp time, xline(1929 1945)
>
> But lets say that I'd like to shade the area between two years (useful if
I
> want to have a bunch of intervals indicating time of recession. Is there a
way
> to do this in STATA?
>
> Thanks.
>
> --John
>

John,

A similar question came up last month.  Gerald Wright (wright1@indiana.edu)
came up with this example to show how it may be done:

preserve
sysuse gnp96,clear
sum gnp
local max=`r(max)'
gen c=`max' if date>q(1992q1)&date<q(2001q1)
lab var c "Clinton Years"
twoway (area c date, bcolor(gs15)) (line gnp date, clpattern(solid))
restore

Hope this helps,
Scott



*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index