I apologize in advance if this query exists already; it seems like it should. Occasionally, I want to limit the range of my y-axis in a marginsplot, even when it might mean cutting off the display of confidence intervals after a certain point on the x-axis. Usually this is for comparability across graphics. Here is an example of what I wish I could do:
But I wish that the yscale range would actually cut the scale, cutting off the error bars at along with the scale --- exactly as it would look if I altered the graphic by hand, basically, to cut that y-range above 20 and between 0 and -20.
This is a general question for two-way plots, I think, but the application makes most sense with marginsplots, where one can clearly follow the error bars in one's mind, even if you cut them off for easy display or comparability across graphics.
Thanks!
Leah
Code:
use http://www.stata-press.com/data/r13/auto generate tons = weight/2000 regress mpg foreign##c.tons##c.tons margins, at(tons=(.8(.05)2.4)) over(r.for) marginsplot, yline(0) yscale(r(-20 20))
This is a general question for two-way plots, I think, but the application makes most sense with marginsplots, where one can clearly follow the error bars in one's mind, even if you cut them off for easy display or comparability across graphics.
Thanks!
Leah
Comment