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

Re: st: graph with valuelabel


From   vwiggins@stata.com (Vince Wiggins, StataCorp)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: graph with valuelabel
Date   Mon, 10 Oct 2005 20:40:51 -0500

Ricardo Ovaldia <ovaldia@yahoo.com> asks why his -twoway lfit- command fails
to use the value labels for his x-variable, even though he specifies 
-xlabel(1 2, valuelabel)-.

Svend Juul <SJ@SOCI.AU.DK> diagnosed the problem when he wrote

> Perhaps surprisingly: -twoway scatter- does what Ricardo wants, but
>
> -twoway lfit- does not.
>
> It could be a deliberate decision, but it is a bit strange.

A semi-deliberate decision; maybe.  Behind the scenes, -twoway lfit- and his
close cousin -twoway qfit- do not use the actual x-variable, but instead
generate their own variable so that you can control the number of points on
the line or curve using -n()- option.  The value labels are not currently
being carried forward to the generated variable.  

No matter the cause, this will be made to work in a future ado update.

Until then, Ricardo can explicitly place the text of the labels on the axis by
modifying his -xlabels()- option to

      xlabel(1 "M" 2 "F", valuelabel)

If instead of two ticks with single character labels, there are many ticks
with long labels, Ricardo could adapt Svend's diagnosis into an alternate work
around.  Add a scatter plot using the same variables and if qualifier before
his linear fit and make the markers invisible -- option -marker(none)-.
Because he would then have two plots, Ricardo will probably want to turn off
the legend, -legend(off)-.

 
-- Vince
   vwiggins@stata.com

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