Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: axis bar starting from 0 on graph (not the label) |
Date | Thu, 20 Oct 2011 09:15:03 +0100 |
Yes and no. You can always add a line at y = 0 by -yline()- and make that as emphatic as you like by varying its width and colour. Making this a light line and the background a little darker can work as well as making this a dark line against a light background. You would have to fight Stata every stop of the way if you wanted to move axis labels, ticks and titles. You'd need to re-create your own. Stata's bias is that although people do sometimes want axes running through the graph, they usually end up very messy, so it won't play willingly. Most statistical software seems to have moved away from the conventions that the axes must be the lines y = 0, x = 0 as high school algebra insists and to separate out the functions of titling, labelling and ticking from showing where the zero lines are. That does not rule out something clever with the Editor or Stata's class language, except that I don't know what it is. If you have access to MS Excel, what you want is I think the default any way, as is all too evident from work I often see. The essence of the problem is that if data points or line can be negatives they often collide with axis stuff. See also http://www.stata-journal.com/article.html?article=gr0043 There have been postings on this in the past, but I didn't find them on a quick search of the archives. Nick On Thu, Oct 20, 2011 at 6:11 AM, lreine ycenna <lreine.ycenna@gmail.com> wrote: > HI, > Is it possible to have the axis line start from where 0 is on the > y-axis? (I'm not talking about labeling my x-axis from 0, but the > x-axis bar) i.e. I have both positive and negative values on my y-axis > and currently the x-xaxis bar starts from the very bottom end of my > y-axis which is negative. Here's the command I use. > > xtreg Y A B AxB, fe > generate income=((_n-1)/10) > matrix b=e(b) > matrix V=e(V) > scalar b1=b[1,1] > scalar b2=b[1,2] > scalar b3=b[1,3] > scalar varb1=V[1,1] > scalar varb2=V[2,2] > scalar varb3=V[3,3] > scalar covb1b3=V[1,3] > scalar covb2b3=V[2,3] > scalar list b1 b2 b3 varb1 varb2 varb3 covb1b3 covb2b3 > gen lab=b1+b3*income > gen conse=sqrt(varb1+varb3*(income^2)+2*covb1b3*income) > gen a=1.96*conse > gen upper=conb+a > gen lower=conb-a > graph twoway (line lab income, clwidth(medium) clcolor(blue) clcolor(black)) * * 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/