Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: behaviour of xtick(##) and ytick(##) options


From   "Nick Winter" <nwinter@policystudies.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: behaviour of xtick(##) and ytick(##) options
Date   Tue, 4 Feb 2003 08:51:55 -0500

Vince Wiggins wrote:
> Graphics in Stata 7 and before attempted to be parental and 
> guess at what you
> meant by an option or specification, with the hope that the 
> result would be
> pretty.  In Stata 8 graphics our overriding rule has been to increase
> flexibility and let users specify exactly what they want, 
> even though the
> result may be ugly.  A large part of the flexibility in the 
> new graphics comes
> from not trying to second guess the user, but rather directly 
> render what is
> requested.

Changing the subject -- am I missing something, or is there no longer
any automated way to get Stata 8 to handle axes the way Stata 7 did by
default: that is, range from data min to max, min and max labeled, with
five tick marks evenly spaced from min to max.  The first two are easy,
with the -xlab(minmax)- and -ylab(minmax)- options.

However, the tick marks aren't so easy, because -xtick(##)- and
-ytick(##)- (that is, options of the form xtick(#5) or xtick(#4) have
code to choose "nice" values for the ticks, which sometimes widen the
range, sometimes fall within the range, and are, in any case, not evenly
spaced.

This seems like an example of Stata doing what it thinks I want, rather
than what I want.  (Or, an example where what I want is "evenly spaced",
and the option on offer is "nice".  You say potatoe . . .)

Is there a way to say, "I want X number of ticks, and I want them spaced
evenly within the graph range"?  The only way I see now is something
like:


	. sum price
	. local ticks `r(min)'(`=(`r(max)'-`r(min)')/4')`r(max)'
	. sc mpg price , xlab(minmax) xtick(`ticks')

Hardly elegant . . .

Am I missing something?
Cheers,
Nick Winter
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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