Statalist


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

RE: st: number format in graph labels


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: number format in graph labels
Date   Wed, 13 Aug 2008 17:22:33 +0100

I should say _in spirit_, as what Steve suggests is not exactly what
-mylabels- does. But the graphs will look the same. 

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: 13 August 2008 17:10
To: statalist@hsphsun2.harvard.edu
Subject: RE: st: number format in graph labels

This is precisely what -mylabels- from SSC can do for you (see my
earlier suggestion, sent at about the same time as this). Doing it from
first principles is always instructive, however. 

Nick
n.j.cox@durham.ac.uk 

Steven Samuels

You can create a new label for the values you want to show on the graph
/**********************************************************************/
sysuse auto,clear

label define gwt000  0 "0" 1000 "1" 2000 "2" 3000 "3" 4000 "4" 5000  
"5" ///
         6000 "6" 7000 "7" 8000 "8" 9000 "9" 10000 "10"
label values weight gwt000
twoway scatter weight trunk, ylabel(0 1000 2000 3000 4000 5000,  
valuelabel) ytitle("Weight (1,000's of Pounds)")

/**********************************************************************/
help -label- will show you how to save such temporary labels for  
further use. Note that you can make the label go as high as you like,  
but use only a subset of values in the -ylabel- option.

On Aug 13, 2008, at 11:29 AM, Maarten buis wrote:

> --- Gisella Young <gisellayoung@yahoo.com> wrote:
>> It occurs to me that a (hopefully) simpler way might just be to title
>> the y-axis "Whatever (thousands)" or "Whatever ('000)" and then have
>> the labels all divided by a thousand, so what would have been 1000000
>> would just be 1000, in which case the absence of spaces doesn't
>> really matter as the smaller number of 0's is easy to see. However
>> I'm not sure if there is an easy way of doing this (in my pre-Stata
>> life I made a lot of graphs in Excel and there is an option to tick
>> to show the graph scale in 100's, 1000's, etc). I don't want to
>> actually divide my y variable by 1000 as i still want the original
>> variable to be used in plotting the chart, but just want to show the
>> variable graphically in '000's - is there a way to do this in Stata?
>
> This is exactly what I would do. If you think carefully about it, an
> option that removes three zeros from the y-axis labels does exactly  
> the
> same thing as dividing your y by 1000 and use that variable for the
> plot.
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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