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
.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityThis 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 optionPlotRange -> {-∞,1}
is notAll
,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}}]
If you look at the implementation of ListLogLogPlot
. Where did you take a look at the implementation? Is that possible?
$\endgroup$
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}}]
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.