Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Grid lines on top of shaded time series graph
From
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: st: Grid lines on top of shaded time series graph
Date
Mon, 31 Oct 2011 11:18:09 +0100
2011/10/30 Jorge Eduardo Pérez Pérez:
> I have been creating time series graphs for several countries with
> recession shading, <snip> I would like the horizontal and vertical
> grid lines on the graph to be on top of the shading. Does anyone
> know how to do this?
In Stata gridlines are always in the background, which fits its logic:
they are the grid on top of which the graphs are drawn. Personally, I
would not try to draw the gridlines on top, but you can with the help
of new calls to -twoway function- to draw horizontal or vertical lines
where the grid lines are. I adapted your example so I need to add both
horizontal and one vertical grid line:
*--------------------------------- begin example
---------------------------------
ssc install freduse, replace
freduse MPRIME, clear
gen ym = mofd(daten)
tsset ym, monthly
twoway ///
function y=20.705,range(119 130) recast(area) color(gs12) base(4.7025) || ///
function y=20.705,range(166 182) recast(area) color(gs12) base(4.7025) || ///
function y=20.705,range(240 274) recast(area) color(gs12) base(4.7025) || ///
function y= 5 ,range(119 274) lstyle(grid) || ///
function y=10 ,range(119 274) lstyle(grid) || ///
function y=15 ,range(119 274) lstyle(grid) || ///
function y=20 ,range(119 274) lstyle(grid) || ///
function y=ym(1980,11), range(4.7025 20.705) horizontal lstyle(grid) || ///
tsline MPRIME if tin(1970m1,1990m1), xlabel(,format(%tm)) lstyle(p1) ///
legend(order(5 1 "Recession")) tlabel(,grid) scheme(s2color)
*---------------------------------- end example
----------------------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* 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/