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

 From "Nick Cox" To Subject RE: st: twoway scatter ..., yscale(log) with axis on log and arithmetic scales Date Sun, 19 Oct 2008 16:30:50 +0100

```If the readership is unfamiliar with logarithms, they will probably feel
more comfortable with base 10 logarithms. Clearly, using -log10()- not

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

Maarten buis

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

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