Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: AW: RE: axis(1) and axis(2) scales in graphs


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: AW: RE: axis(1) and axis(2) scales in graphs
Date   Tue, 26 Jan 2010 15:20:05 -0500

e.g.

sysuse sp500, clear
g fake=volume-16000
line fake date in 1/10||line change date in 1/10, yaxis(2)
g fh=fake/100
la var fh "Volume in hundreds less 160"
line fh change date in 1/10, name(better)


On Tue, Jan 26, 2010 at 3:13 PM, Austin Nichols <[email protected]> wrote:
> Leandro Brufman <[email protected]>:
> The -range- option will not shrink the range if -graph- thinks you
> need a wider range.  Why can't you follow Nick's advice and divide one
> series by an appropriate constant?
>
> On Tue, Jan 26, 2010 at 2:40 PM, Leandro Brufman
> <[email protected]> wrote:
>> Thank you very much for your answers. I was thinking on one possible
>> solution to this problem. Making both sides symmetric. For example, if
>> the right hand axis ranges from -6 to 6 and the left hand axis ranges
>> from -25 to 25, then in both cases zero should be at the middle,
>> right? (see example)
>> ****** begin example *************
>> clear*
>> set seed 123456
>> set obs 100
>> gen time=_n
>> gen serie1=rnormal()
>> gen serie2=rnormal(1,2)
>> tw ///
>>  || line serie1 time, yaxis(1) ///
>>  || line serie2 time, yaxis(2) ///
>>  || , yscale(range(-6 6) axis(1)) ///
>>      yscale(range(-25 25) axis(2)) ///
>>      yline(0)
>> ****** end example *************
>>
>> Well, the thing is that I am running the same graph for different
>> countries, so I would like to have different ranges for each country.
>> So I tried summarizing serie1 and serie2 for each country and saving
>> it into a local macro, so that I can latter put it on range. But for
>> some reason I had to use global macros (local macros disappeared after
>> the loop), and when trying to implement this code it doesn't work
>> properly (that is, I do not get the same results as in the previous
>> example.
>>
>

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index