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

Re: st: quirk: xlab overrides xscale in Stata8


From   Roger Newson <roger.newson@kcl.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: quirk: xlab overrides xscale in Stata8
Date   Thu, 27 Mar 2003 12:28:10 +0000

At 12:31 27/03/03 +0100, Jan Brogger wrote:
Just upgraded to Stata 8, latest updates, Windows XP. A quirk discovered
in graphics. Stata8 does not respect the "xscale" option when it figures
out the "xlabels", and then "xlabels" takes precedence over "xscale" in
the drawing of the axis. It appears that "xscale" can only be used to
expand the xaxis to the right, not truncate it (even though you are
within the limits of the data). You have to change both xscale and xlab
to achieve the desired effect. An example:

sysuse auto
*range of weight is 1760 ro 4840
summ weight

*default plot, x scale ranges from 1760 to 5000:
scatter turn weight

*plot with x scale expanded to 6000, no problem:
scatter turn weight, xsc(r(0,6000))

*plot with x scale restricted to the maximum value of the data, does NOT
work:
scatter turn weight, xsc(r(0,4840))

*you have to also change the xlab option, then xscale takes effect.
scatter turn weight, xsc(r(0,4840)) xlab(2000 4840)

This is somewhat counter-intuitive.
However, I think you'll find that it is the same in Stata 7. That is to say,

grap weight mpg,xlab(10(5)50)

gives the same graph as

grap weight mpg,xlab(10(5)50) xsc(10 45)

because -xscale- can only expand the scale, not contract it. (In Stata 8, substitute -graph7- for -grap- in the above.)

Best wishes

Roger







--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: roger.newson@kcl.ac.uk

Opinions expressed are those of the author, not the institution.

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