Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

change the base of the Log[] used by LogLogPlot?

771 views
Skip to first unread message

Nasser M. Abbasi

unread,
Oct 6, 2010, 3:15:55 AM10/6/10
to
Mathematica experts:

I want to use LogLogPlot, say as in LogLogPlot[x,{x,.1,1}], but I want
the Log to be in base 10, not in base e as the default used.

Looking at the doc, I can't see it. No option to change the base.

I can ofcourse build my own data, and use ListPlot, but LogLogPlot
handles the ticks better automatically and it samples better. Same
question applies for LogPlot, LogLinearPlot, ListLogPlot,
ListLogLinearPlot, etc...

I am sure this is hidden somewhere in the documentation :)

Version 7.0

thanks,

--Nasser

Sjoerd C. de Vries

unread,
Oct 7, 2010, 3:36:09 AM10/7/10
to
Hi Nasser,

LogLogPlot sets up axes as log base 10. I don't know where you've
learned that it's base e, but it's not true.

However, If you are going to plot additional graphics, e.g. by using
Epilog, you will notice that those coordinates have to be log base e
to arrive at the desired location. For example:

LogLogPlot[x, {x, .1, 1}, Epilog -> Point[{Log[E, 0.5], Log[E, 0.5]}]]

Cheers -- Sjoerd

Nasser M. Abbasi

unread,
Oct 7, 2010, 3:36:20 AM10/7/10
to
On 10/6/2010 8:29 AM, Brett Champion wrote:

> On Oct 6, 2010, at 2:15 AM, Nasser M. Abbasi wrote:
>
>> Mathematica experts:
>>
>> I want to use LogLogPlot, say as in LogLogPlot[x,{x,.1,1}], but I want
>> the Log to be in base 10, not in base e as the default used.
>>
>> Looking at the doc, I can't see it. No option to change the base.
>>
>> I can ofcourse build my own data, and use ListPlot, but LogLogPlot
>> handles the ticks better automatically and it samples better. Same
>> question applies for LogPlot, LogLinearPlot, ListLogPlot,
>> ListLogLinearPlot, etc...
>>
>> I am sure this is hidden somewhere in the documentation :)
>>
>

> Nope. LogPlot uses Log.
>
> I'm curious as to why you want to switch to Log10 since the plot would
> end up looking exactly the same.
>

hi;

If both the x and y are in log scale, yes, the look the same (but ticks
are not for all the bases).

---- loglog-------
x = {1, 2, 3, 4};
data1 = Table[{Log[10,x], Log[10, x]}, {x, 1, 10}];
data2 = Table[{Log[x], Log[x]}, {x, 1, 10}];
Show[{ListPlot[data1, PlotStyle -> Red, Joined -> True],
ListPlot[data2, Joined -> True]}]
---------------

But not if x is linear and y is log, then the plot are not the same:

----loglinear-------
x = {1, 2, 3, 4};
data1 = Table[{x, Log[10, x]}, {x, 1, 10}];
data2 = Table[{x, Log[x]}, {x, 1, 10}];
Show[{ListPlot[data1, PlotStyle -> Red, Joined -> True],
ListPlot[data2, Joined -> True]}]
---------------------

any way, not too important, just was wondering ;)

thanks,
--Nasser

Brett Champion

unread,
Oct 7, 2010, 3:35:47 AM10/7/10
to
On Oct 6, 2010, at 2:15 AM, Nasser M. Abbasi wrote:

> Mathematica experts:
>
> I want to use LogLogPlot, say as in LogLogPlot[x,{x,.1,1}], but I want
> the Log to be in base 10, not in base e as the default used.
>
> Looking at the doc, I can't see it. No option to change the base.
>
> I can ofcourse build my own data, and use ListPlot, but LogLogPlot
> handles the ticks better automatically and it samples better. Same
> question applies for LogPlot, LogLinearPlot, ListLogPlot,
> ListLogLinearPlot, etc...
>
> I am sure this is hidden somewhere in the documentation :)
>

Nope. LogPlot uses Log.

I'm curious as to why you want to switch to Log10 since the plot would
end up looking exactly the same.

Brett Champion
Wolfram Research

Brett Champion

unread,
Oct 7, 2010, 3:36:31 AM10/7/10
to
On Oct 6, 2010, at 11:07 AM, Nasser M. Abbasi wrote:

> On 10/6/2010 8:29 AM, Brett Champion wrote:

> But not if x is linear and y is log, then the plot are not the same:
>
> ----loglinear-------
> x = {1, 2, 3, 4};
> data1 = Table[{x, Log[10, x]}, {x, 1, 10}];
> data2 = Table[{x, Log[x]}, {x, 1, 10}];
> Show[{ListPlot[data1, PlotStyle -> Red, Joined -> True],
> ListPlot[data2, Joined -> True]}]
> ---------------------
>
> any way, not too important, just was wondering ;)

My point is that these look the same:

{ListPlot[data1, PlotStyle -> Red, Joined -> True],
ListPlot[data2, Joined -> True]}

(ignoring the ticks which get adjusted anyway.)

Brett Champion
Wolfram Research

Nasser M. Abbasi

unread,
Oct 7, 2010, 3:36:43 AM10/7/10
to

When you say "these", you seem to have used the loglog version. Yes.

But when x is linear, and y is log (like Mathematica LogPlot), then
different bases used for the log make a different looking plots. (how
can y=log(10,x) = log(x) ?), different y values for same x value result:

Please see screen shot.

http://12000.org/tmp/oct62010/Untitled.png

For the loglog, yes, becuase both are scaled same way. But then have to
adjust ticks.

Thanks,

--Nasser

Bob Hanlon

unread,
Oct 7, 2010, 3:39:49 AM10/7/10
to

The only difference the base would make would be the required adjustment of the ticks. Any base would result in an identical plot; so use the default.

Partition[Plot[Log[#, x], {x, .1, 1},
Frame -> True, Axes -> False,
Epilog ->
Text[Style["base = " <> ToString[#], 14],
{.7, Log[#, .2]}]] & /@
{E, Pi, 10, RandomReal[{2, 500}]},
2] //
Grid


Bob Hanlon

---- "Nasser M. Abbasi" <n...@12000.org> wrote:

=============
Mathematica experts:

I want to use LogLogPlot, say as in LogLogPlot[x,{x,.1,1}], but I want
the Log to be in base 10, not in base e as the default used.

Looking at the doc, I can't see it. No option to change the base.

I can ofcourse build my own data, and use ListPlot, but LogLogPlot
handles the ticks better automatically and it samples better. Same
question applies for LogPlot, LogLinearPlot, ListLogPlot,
ListLogLinearPlot, etc...

I am sure this is hidden somewhere in the documentation :)

Version 7.0

thanks,

--Nasser


fish...@cougars.csusm.edu

unread,
Apr 16, 2013, 12:34:43 AM4/16/13
to
Hello everyone,

I'm confused too. I'm trying to plot this code below via mathematica however I can't get the plot to come out correctly.
R = 10;
L = 0.01;
C = 2.533e-8;
f = logspace(3,5,2000);
w = 2*pi*f;
H = R./(R+j*w*L + 1./(j*w*C ));
semilogx(f,20*log10(abs(H)))

I've tried using LogLinearPlot to replicate it in mathematica but when I try I get something completely different! Not sure why.

0 new messages