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

st: RE: [Stata 9] scatter axis bug


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: [Stata 9] scatter axis bug
Date   Tue, 3 May 2005 21:05:23 -0500

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of David Airey
> Sent: Tuesday, May 03, 2005 5:36 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: [Stata 9] scatter axis bug
> 
> I have some weird behavior in a simple scatter plot. The choice of
> axis range takes on the range of the data if one looked at each
> variable one at a time, but not the range of the plotted data. For
> example,
> 
> . d ln_rna hrsd17
> 
>                storage  display     value
> variable name   type   format      label      variable label
> ------------------------------------------------------------------------
> -------
> ln_rna          float  %9.0g
> hrsd17          byte   %8.0g
> 
> . scatter ln_rna hrsd17  // <-- gives a bad graph with lots of white
> space around the cloud
> 
> // y range 2 to -2, x range 10 to 35
> // from below it should have reflected the common range
> 
> . summ ln_rna hrsd17
> 
>      Variable |       Obs        Mean    Std. Dev.       Min        Max
> -------------+--------------------------------------------------------
>        ln_rna |        69    .5711169    .6988654  -1.479932   2.003551
>        hrsd17 |       107    22.31776    3.664202         11         33
> 
> . summ ln_rna hrsd17 if ln_rna < . & hrsd17 < .
> 
>      Variable |       Obs        Mean    Std. Dev.       Min        Max
> -------------+--------------------------------------------------------
>        ln_rna |        32     .569358    .7230897  -.6635817   2.003551
>        hrsd17 |        32          23    3.360108         16         31
> 
> 
> 
> // a simple example of the problem:
> 
> input y x
> 1 .
> 20 50
> 30 40
> 40 30
> 50 20
> . 1
> end
> 
> scatter y x
> 
> // gives the range of the scatter plot as 0-50 on both axes--this
> looks stupid--can we fix this?
> 

Dave,

How about:

scatter y x if !mi(x,y) (?)

One thing to consider is that your original graph informs the reader that
there are missing observations in the data set, which would not be apparent
if the range was restricted jointly non-missing values.

Scott



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