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

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

From   Maarten buis <>
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 <> 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 )

Hope this helps,

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

visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515

+31 20 5986715

Send instant messages to your online friends 
*   For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index