Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Why does the PlotRange option in

list=Table[{x,Exp[Sqrt[x]]},{x,0,25}];
ListLogLogPlot[list,PlotRange->{0,10},Joined->True]

not work although there is no error-output? The same holds for ListLogLogPlot.

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

This is because you gave 0 as the lower limit and $\log (0)=-\infty$. If you look at the implementation of ListLogLogPlot, you'll see that somewhere along the line, the limits are converted to {N@Log@min, N@Log@max} and then plotted with ListPlot and the tick labels are tidied up. This is the specific line in the implementation:

logYPlotRange[{min_?Positive, max_?Positive}, r_] :=  N[{Log[min], Log[max]}]

So an extreme plot range will automatically be converted to something more "reasonable" that displays the plot. However, I do agree that a warning should be included. For instance, if you use -∞ as a plot range in Plot, you get the following warning:

Plot::prng: Value of option PlotRange -> {-∞,1} is not All, Full, Automatic, a positive machine number, or an appropriate list of range specifications. >>

If you want to set the limits for the axes from within PlotRange, then avoid 0. For example:

list = Table[{x, Exp[Sqrt[x]]}, {x, 0, 25}];
ListLogLogPlot[list, Joined -> True, PlotRange -> {{1, 10}, {1, 50}}]

share|improve this answer
add comment

I've seen problems with this before but can't find the reference right now. So here is a solution:

list = Table[{x, Exp[Sqrt[x]]}, {x, 0, 25}];
ListLogLogPlot[list, Joined -> True, PlotRange -> {1, 10}]

or

list = Table[{x, Exp[Sqrt[x]]}, {x, 0, 25}];
ListLogLogPlot[list, Joined -> True, PlotRange -> {All, {1, 10}}]

loglogplot

The problem of course could be called a bug, but in some sense it's also understandable that the plot range specification breaks when you put in a value of 0 for the argument on the x or y axis in a log-log plot. After all, the logarithm isn't defined there. It would be better if the function could recognize this and warn you, instead of ignoring the input altogether.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.