Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Jorge Eduardo Pérez Pérez <perez.jorge@ur.edu.co> |

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

Subject |
Re: st: Grid lines on top of shaded time series graph |

Date |
Mon, 31 Oct 2011 11:11:05 -0400 |

Thank you both for your suggestions. I was afraid that I would have to replace the grid lines with other line plots as in Maarten's example. This solution works, but it is specific to each graph, and I have to draw many of them. Maarten chose 5,10,15 and 20 as values for the gridlines and knew the horizontal range of the lines. Any suggestions on how to choose these values automatically depending on the graph? Thanks, _______________________ Jorge Eduardo Pérez Pérez On Mon, Oct 31, 2011 at 6:18 AM, Maarten Buis <maartenlbuis@gmail.com> wrote: > 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/ > > > * * 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/

**Follow-Ups**:**RE: st: Grid lines on top of shaded time series graph***From:*Nick Cox <n.j.cox@durham.ac.uk>

**References**:**st: Grid lines on top of shaded time series graph***From:*Jorge Eduardo Pérez Pérez <perez.jorge@ur.edu.co>

- Prev by Date:
**Re: st: Bug? Margins Row Names** - Next by Date:
**Re: st: zoib** - Previous by thread:
**Re: st: Grid lines on top of shaded time series graph** - Next by thread:
**RE: st: Grid lines on top of shaded time series graph** - Index(es):