AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Xline stata color8/15/2023 ![]() ![]() 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. Tukey and his colleagues and students publicized them energetically in the. Box plots have been a standard statistical graph since John W. Cox Department of Geography Durham University Durham City, UK n.j.coxdurham.ac.uk Abstract. 478496 Speaking Stata: Creating and varying box plots Nicholas J. keep ( L.FTEenroll ) color ( gray ) ), legend ( on ) xline ( 0 ). The Stata Journal (2009) 9, Number 3, pp. ![]() As we supply two pairs of coordinates the result is a single straight line (which happens to be horizontal). , keep ( L.nettuitionrevadj ) color ( black ) ) /// (. Now the key is to fire up twoway scatteri but to recast the two points (in this case) to a line. 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. graph line y x, lcolor(red) causes the line through the (y, x) point to be drawn in red. Is it possible to force Stata to place this horizontal line on top of all other plots in the graph? Remarks and examples Lines occur in many contexts and, in some of those contexts, the above options are used to determine the look of the line. 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 1 Im trying to create a twoway line graph in Stata that, because it will likely be photocopied and/or printed in black & white, we need to use dashed and dotted lines to differentiate between lines. 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. 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
Read More
Leave a Reply. |