![]() You want a line which corresponds with 0 on the second y axis: (scatteri 0 `t1' 0 `t2', recast(line) yaxis(2))įor similar problems, one should be able to calculate the appropriate coordinates from the data in each case or fall back on a constant variable plotted as a horizontal line graph.ĮDIT: Revised version benefits from comments by Roberto Ferrer. As we supply two pairs of coordinates the result is a single straight line (which happens to be horizontal). > xline(1 2 etc)) each with different line pattern styles. For example for the xline 49.90, I want a SA label saying 'mean South African hourly wage', 26.34 'median South African hourly wage' etc. However I am unsure how to label these xlines. Now the key is to fire up twoway scatteri but to recast the two points (in this case) to a line. On Sat, 19/12/09, Robert Duval wrote: > I have a graph with several vertical reference lines (i.e. 1 Labelling 'xline', 01:50 Hello all, I have a CDF with a few 'xlines'. ![]() In other examples, this may be dispensable. The technique below is more general in not assuming that the added line need be horizontal.įirst for convenience, we calculate the endpoints of the line and put them in local macros. One way to do that is just to define a variable which is constant and plot it as a line graph. So, to subvert that you have to supply your line as data. In essence, the idea behind yline() and similar options is to supply reference lines, which are never to be plotted on top of the data. Is it possible to force Stata to place this horizontal line on top of all other plots in the graph? The horizontal line is obscured by the shading because the shading is created first, but I need the shading to be created first because otherwise, it obscures the plot of the time series (since Stata doesn't support transparency/alpha blending). In practice, the indicator variable could be anything, which is why I don't want to hard code the values to shade in the twoway command, as seen in this Statalist post or the nber plugin in the SSC. Ly_dev is the time series, and USRECQ is the indicator variable. Ytitle("Deviation from trend", axis(2))), Here is an example, using the freduse plugin ( ssc install freduse, replace): freduse GDPC1 USRECQ, clear I want to draw a horizontal line at the point on the y-axis where the time series equals 0. Time periods are shaded if the indicator variable equals 1, and not shaded if it's missing. Other users who have found the question cross-posted are encouraged to share the links as a reply as well.I'm graphing a time series and shading certain time periods based on a Boolean indicator variable in Stata 13.1 on Windows 7.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |