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 |
Nick Cox <n.j.cox@durham.ac.uk> |

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 17:06:28 +0000 |

Grid lines are automatic with e.g. -xla(, grid)- For more discussion, see SJ-9-4 gr0043 . . . . . . . . . . Stata tip 82: Grounds for grids on graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox Q4/09 SJ 9(4):648--651 (no commands) tip on when a grid within a graph is appropriate Nick n.j.cox@durham.ac.uk -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Jorge Eduardo Pérez Pérez Sent: 31 October 2011 15:11 To: statalist@hsphsun2.harvard.edu Subject: Re: st: Grid lines on top of shaded time series graph 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 ) > * * 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/

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

**Re: 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: RE: replacing var if it meets criteria** - Next by Date:
**RE: st: RE: replacing var if it meets criteria** - Previous by thread:
**Re: st: Grid lines on top of shaded time series graph** - Next by thread:
**st: How to extract matched sample in psmatch2** - Index(es):