RE: st: twoway scatter ..., yscale(log) with axis on log and arithmetic scales

 From Maarten buis To statalist@hsphsun2.harvard.edu Subject RE: st: twoway scatter ..., yscale(log) with axis on log and arithmetic scales Date Sun, 19 Oct 2008 11:13:37 +0100 (BST)

```--- Joana Cunha-Cruz <cunhacruzj@yahoo.com> wrote:
> What I want with the graph is to show the values of the data on both
> scales (for the reader not familiar with log scale, they can see how
> the numbers correspond from one scale to the other).

Notice that by default the numbers on the axes are still on the
original (not log) scale, so I think adding extra axes with the log
values just adds confusion to those unfamiliar with them, rather than
solves it. If you still want to do that than this is how you do it:

*--------------------- begin example --------------------------
sysuse auto, clear
twoway scatter price mpg, yscale(log) xscale(log)
forvalues n= 5000(5000)15000{
local ylab `ylab' `n' "`=string(log(`n'),"%9.2f")'"
}
forvalues n = 10(10)40 {
local xlab `xlab' `n' "`=string(log(`n'),"%9.2f")'"
}

twoway scatter price mpg, yaxis(1) xaxis(1)        ///
yscale(log axis(1)) xscale(log axis(1)) ||  ///
scatter price mpg, yaxis(2) xaxis(2)        ///
yscale(log axis(2)) xscale(log axis(2))     ///
ylab(`ylab', axis(2)) xlab(`xlab', axis(2)) ///
msymbol(i) legend(off)                      ///
ytitle("ln(price)", axis(2))                ///
xtitle("ln(mpg)", axis(2))
*--------------------- end example ----------------------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

Buitenveldertselaan 3 (Metropolitan), room N515

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

Send instant messages to your online friends http://uk.messenger.yahoo.com
*
*   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/
```