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

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


From   [email protected] (Vince Wiggins, StataCorp)
To   [email protected]
Subject   Re: st: behaviour of xtick(##) and ytick(##) options
Date   Tue, 04 Feb 2003 10:47:53 -0600

Nick Winter <[email protected]>, using Stata 8, asks about getting a
fixed number of unlabeled ticks between his labeled ticks,

> [...] 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, [...]

In Stata 8 graphics, the positions of major labels and ticks, options
[x|y]label() and [x|y]tick()), are specified over the whole range of the x- or
y-axis.  Minor labels and ticks, options [x|y]mtick() and [x|y]mlabel(), can
also be specified at positions between the major and ticks using the #<#>
rule, see -whelp axis_label_options-.  Taking Nick's example, we can add three
minor x-axis ticks, placing them equally spaced between the minimum and
maximum labeled ticks, using the -xmticks- option,

	. sc mpg price , xlab(minmax) xmticks(##4)

If Nick does not like that the minor ticks are shorter than the labeled ticks,
he can specify their length with the suboption tlength(),

	. sc mpg price , xlab(minmax) xmticks(##4, tlength(scheme tick))

That was a bit unfair.  I used an undocumented feature of named styles that
allows an indirect reference to settings in the current graphics scheme to be
used in place a style name or explicit value.  Most graphics schemes define a
default major tick length and that length is defined under the name -tick-, so
by specifying -tlength(scheme tick)- we were requesting the default major tick
length specified in the current scheme file.  

Alternately, Nick could type

	. sc mpg price , xlab(minmax) xmticks(##4, tlength(tiny))

to specify that the minor tick length is -tiny-, though settling on -tiny-
might require some experimentation.

 
-- Vince
   [email protected]

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index