[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: graph bug? |

Date |
Thu, 25 Jul 2002 10:24:24 +0100 |

Enzo Coviello > > in a two way graph, label of yvar disappears when symbol(i) > is specified: > > . use "C:\DATA\auto.dta", clear > (1978 Automobile Data) > > . de > > Contains data from C:\DATA\auto.dta > obs: 74 1978 Automobile Data > vars: 12 20 Jul 2002 12:51 > size: 3,478 (99.5% of memory free) > ------------------------------------------------------------ > ------------------- > storage display value > variable name type format label variable label > ------------------------------------------------------------ > ------------------- > ..... > weight int %8.0g Peso > length int %8.0g lunghezza > ...... > ------------------------------------------------------------ > ------------------- > Sorted by: foreign > > > > . graph length weight,s(o) c(l) sort > > > Label of length is shown. Otherwise if s(i) is specified > length label > disappears > > > . graph length weight,s(i) c(l) sort > I too have experienced this behaviour, often, and I am going to try to convince you that it's not a bug, but a feature. Quite right, that's not original (your mailer may wrap this URL): http://www.tuxedo.org/~esr/jargon/html/entry/That's-not-a-bug-that's-a -feature!.html I guess this kind of example was the original motivation: Read in the auto data (Enzo clearly has a version with Italian labels, using Stata 10's behaviour of translating automatically to the language you prefer): . u auto . gen gpm = 1 / mpg . reg gpm weight We should want to see a scatter plot and regression line: . predict predmpg . graph gpm predmpg weight, sy(oi) c(.l) sort All we want so far as the line is concerned (usually) are invisible point symbols connected up. As Enzo reports, -graph- has a rule: no variable label (or variable name when no label exists) is shown corresponding to a variable shown with -sy(i)-. Therefore, "gpm" alone is shown by default as the -l1title()-, which I guess is what most people would think natural for this kind of graph. -predmpg- as far as the graph is concerned is a variable constructed for a purpose and not data in the strict sense. Now consider what happens when we ask for . graph gpm predmpg weight, sy(o.) c(.l) sort i.e. a point symbol, not invisible symbols. -graph- now faces a conflict: two variable names both have a claim to be shown in the -l1title()-. Stata gives up on this: it declines to write the two on top of each other; it might try to guess which variable name you really want there, but Stata here prefers to pass the buck back to you: "If you want some text in -l1title()-, you just have to tell me what you want." That is, arguing backwards, this rule is a feature for those situations in which one variable is, for graphical purposes, one which you wish to keep quiet. This point leads naturally to a suggestion for Enzo's problem: . graph length weight, s(.) c(l) sort The point symbol will, for all practical purposes, be invisible, but the variable label will reappear. Nick n.j.cox@durham.ac.uk * * 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/

**Follow-Ups**:**st: stata10's behaviour?***From:*Enzo Coviello <Enzo.Coviello@tin.it>

**References**:**st: graph bug?***From:*Enzo Coviello <Enzo.Coviello@tin.it>

- Prev by Date:
**st: Empirical Bayes using meta ado** - Next by Date:
**st: RE: Re: RE: RE: mapping a value from 2 variables** - Previous by thread:
**st: graph bug?** - Next by thread:
**st: stata10's behaviour?** - Index(es):

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