[R] Plotting log-axis with the exponential base to a plot wi

(Ted Harding) Ted.Harding at manchester.ac.uk
Sun May 9 22:36:40 CEST 2010


On 09-May-10 20:15:56, Elisabeth Bjerke Rastad wrote:
> Hello Ted!
> Thank you a lot for your reply!!!
> I will try to explain again; what I want is a logarithmic scaled
> y-axis with the base of e (not 10). And the values I would like
> to use in the plot are the raw values (not transformed in any way).
> Do you still think that the base of log does not matter in this
> case (whether it is e or 10 as a base)?
> 
> Elisabeth

Hi Elisabeth! If the values displayed in the y-axis annotation
are raw y-values (i.e. equal increments in distance along the
y-axis correspond to equal multiples of the raw y-value), then
it does not matter. By default, plot() (therefore lineplot.CI())
will choose the plotting extent so as to nicely include all
the plotted values, and will choose the numbers placed against
the y-axis as annotations according to a nice ("pretty") set
of increasing values. These numbers will usually be a series
of "round" numbers, not necessarily increasing in a regular
manner (e.g., as in my "plot(5*Y,log="y")" example below,
0.5, 1.0, 2.0, 5.0, 10.0, 20.0, 50.0) and will not be equidistant
either. But, since the log(Y)'s (to any base of logs) will be
fitted into the available length of y-axis (which by default
is pre-set), and the annotation with raw y-values will be correct
for the untransformed y's, and since the log to base A is a
constant multiple of the log to base B, whatever base the logs
are taken to will not affect the plot.

However (as I indicated below) if you want the *logs* of the
y-values to be used as annotation then it is a different matter
(but it seems that this is not what you want).

I hope this helps!
Ted.

>> On 09-May-10 18:10:27, Elisabeth Bjerke Rastad wrote:
>>> Hello!
>>> I have a problem which I have tried to solve for several days now..
>>> I have plottet a lineplot.CI in the library "sciplot", and I am
>>> trying to plot it with a logaritmic y-axis (with exponential base).
>>>
>>> The problem is that; when I type "log "y"", the axis transforms
>>> into the logaritmic of base 10.
>>>
>>> I wonder if someeone could tell me how to specify that I would like
>>> to use the exponential logaritmic y-axis. I have tried a lot (but
>>> obviously not all, I guess this problem is possible to solve..)
>>>
>>> Hope you would like to help me! Thank you a lot in advance!!
>>> Greetings,
>>> Elisabeth B. Råstad
>>> (Master's student, Norway)
>>
>> I think there may be some misunderstanding here. Or else you have
>> not fully explained what you want.
>>
>> When you use plot(Y,log="y") (and lineplot.CI() is simply a wrapper
>> for plot()) 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, since (for instance)
>>
>>   log(y) = log(10)*log10(Y)
>>
>> so it is simply a linear transformation of the log scale and,
>> since the *raw* values are used to annotate the axis it would
>> make no difference to the plot.
>>
>> Compare for instance
>>
>>   Y <- 10*runig(100)
>>   plot(Y,log="y")
>>
>> with
>>
>>   plot(5*Y,log="y")
>>
>> I don't see anything there which is tied to the base of logs.
>>
>> It may be that what you want is the plot of the logarithm
>> (i.e. the annotation of the Y-axis is in terms of log(Y),
>> not in terms of raw Y).
>>
>> In that case you will need to play with the lower-level graphical
>> paramaters such as "yaxp"; but is this is so then please confirm
>> in more detail!
>>
>> Ted.
>>
>>
>> --------------------------------------------------------------------
>> E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
>> Fax-to-email: +44 (0)870 094 0861
>> Date: 09-May-10                                       Time: 20:11:38
>> ------------------------------ XFMail ------------------------------
>>
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 09-May-10                                       Time: 21:36:35
------------------------------ XFMail ------------------------------



More information about the R-help mailing list