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

Re: st: RE: Automatically changing -ylabel()- values using -graph-


From   Nick Winter <[email protected]>
To   [email protected]
Subject   Re: st: RE: Automatically changing -ylabel()- values using -graph-
Date   Mon, 06 Jun 2005 09:28:35 -0400

If you find yourself doing this a lot, you can use a program to generate the label string. Something like this:

program faclbl, rclass
syntax anything(name=numlist id="Label List") , ///
[ Factor(int 100) local(string) ]

numlist "`numlist'"
foreach v in `r(numlist)' {
local newlbl `"`newlbl' `v' "`=`v'*`factor''""'
}

return local label `newlbl'
if "`local'"!="" c_local `local' `newlbl'
end


Then you could type

. faclbl -6[2]6 , local(xlab)

. graph twoway scatter .... , xlabel(`xlab') ...


--Nick Winter




At 04:42 PM 6/5/2005, you wrote:

Scott Merryman replied:

> How about using the rule option for the axis labels?  Something like:
>
> . use http://www.stata-press.com/data/r9/ibm.dta
> (Source: Yahoo! Finance)
>
> . tsline ibm, ylabel(-6 "-600" -4 "-400" -2 "-200" 0 "0" 2 "200" 4 "400",
> angle(0))

It's a rather workmanlike option, isn't it? Still, if that's the best
there is within the confines of Stata 8.2, then fair enough. Thanks very
much.

CLIVE NICHOLAS        |t: 0(044)7903 397793
Politics              |e: [email protected]
Newcastle University  |http://www.ncl.ac.uk/geps

*
*   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/
--------------------------------------------------------
Nicholas Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government [email protected] e
308 White Hall falcon.arts.cornell.edu/nw53 w
Cornell University
Ithaca, NY 14853-4601
*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index