Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Re: x and y axis in the middle


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Re: x and y axis in the middle
Date   Sun, 18 Oct 2009 16:38:21 +0100

I agree with Kit's stance here, although I think it's not obviously easy
to get ticks on -yline()- and -xline()-. 

Like many others no doubt, I have got so used to Stata's keeping the
axis stuff on the graph margins that it comes as a visceral shock when I
see  graphs from other software in which the axes and their labels and
ticks interfere with data points near the axes. That I suggest, as does
Kit, is a tradition perpetuated by bad teaching and bad software and
best abandoned. 

I've been interested to look at the graphics style in 

Wickham, Hadley. 2009. ggplot2: Elegant graphics for data analysis. New
York: Springer.

Somewhat in his spirit, here is one variation on Kit's style: 

... yline(0, lstyle(grid) lw(*2)) xline(0, lstyle(grid) lw(*2))

That is, 

1. You can make the extra -yline()- and -xline()- have the same style as
your grid lines.

2. But you can also make them a little more prominent by changing the
width. 
 
Nick 
n.j.cox@durham.ac.uk 

Kit Baum

You guys mean the crappy-looking thing that M$ Excel does with the  
axes, labels, etc. running through the middle of the graph in both  
directions and stomping on the data points in the vicinity? I would  
not want to assist anyone in the creation of such an abomination. It  
would certainly be possible to place ticks on the yline(0) and xline 
(0), but that's as far as that should go.

Kit Baum

>> sysuse auto
>> expand 2
>> replace price = -price in 75/l
>> replace mpg = -mpg in 75/l
>> scatter price mpg, yscale(noline) ylabel(,grid) xscale(noline) xlabel
>> (,grid) yline(0) xline(0)


*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index