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

Re: st: RE: Rare bug/feature in -graph,ylog-

From   Roger Newson <>
Subject   Re: st: RE: Rare bug/feature in -graph,ylog-
Date   Mon, 04 Nov 2002 15:09:29 +0000

At 08:54 04/11/02 -0500, Tom Steichen wrote:
Roger Newson writes (in part):

> I think I have discovered a rarely-encountered bug/feature in
> the Stata -graph- command. (I use the very latest Stata 7
> under Windows 98 SE.) It appears that, if there is only one
> observation in the selected sample, and -ylog- (or -xlog-) is
> specified, and the single y-value (or x-value) is in the open
> interval between one and zero, then -graph- complains of
> non-positive values.

The issue at hand here has to do with Stata setting an automatic
width for the axis when the user does not specify it.  With only
one point, Stata chooses to set the axis width to be 1 unit about
the point, so when the single point is in the (0,1) interval, 0
becomes the lower graphing limit and, thus, the log transform
tries to operate on non-positive values.
However, even if I do specify the axis labels and/or scales, -graph- still complains in the same way:

. list gpm in 1

1. .0243902

. grap gpm weight in 1,ylog ylab(0.01 0.02 0.03)
nonpositive values encountered

. grap gpm weight in 1,ylog ylab(0.01 0.02 0.03) ysc(0.01 0.03)
nonpositive values encountered

In these cases, there is no need for Stata to guess default axis widths and to encounter non-positive values.


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

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

* For searches and help try:

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