# [R] [Fwd: Re: Plotting log-axis with the exponential base to a plot with the default logarithm base 10]

Mark Difford mark_difford at yahoo.co.uk
Tue May 11 10:01:48 CEST 2010

```Elisabeth,

>> the vertical axis is scaled logarithmically with the
>> numerical annotations corresponding to the *raw* values of Y,
>> not to their log-transformed values. Therefore it does not matter
>> what base of logarithms is used...

question:

>> How is it that you recognise that it is
>> "a logaritmic axis with the base of 10", as opposed to any other base?

Maybe a little graphic demonstration (run the script below) will help to
convince you. The top row of the figure re-poses Ted's question, viz "How do
you know which logarithmic base was used to plot which sub-figure?" You will
see from my script that the first is plotted using natural logs, whereas the
next two use logs to base 10. (The last of them uses R's log="y" argument.)
What's the difference?

The first two sub-figures on the bottom row show the scales that were hidden
in the sub-figures above them (from the script you will see that all I did
was turn off the annotation/labelling of the scale).

The last sub-figure on the bottom row is identical in __appearance__ to that
above it. However, as you will see from my script, it plots data that have
been transformed to natural logarithms. For scale-annotation, however, I
have used raw data values. That was Ted's first point: it doesn't matter
which base of logarithm your data have been transformed to if you annotate
the scale using (backtransformed) raw values.

## Show that log="y" does the job you want done even if internally it uses
logs to the base 10
## rather than natural logarithms
par(mfrow=c(2,3))
plot(log(1:10), yaxt="n", ylab="")
plot(log10(1:10), yaxt="n", ylab="")
plot((1:10), log="y")
plot(log(1:10))
plot(log10(1:10))
plot(log(1:10), yaxt="n")
axis(side=2, at=sapply(c(1,2,5,10), FUN=function(x) log(x)),
labels=c(1,2,5,10))

Regards, Mark
--
View this message in context: http://r.789695.n4.nabble.com/Fwd-Re-Plotting-log-axis-with-the-exponential-base-to-a-plot-with-the-default-logarithm-base-10-tp2172435p2173481.html
Sent from the R help mailing list archive at Nabble.com.

```