. 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
[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/