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.

I would like to generate a ListLogLinearPlot that automatically shows all the data points. However the option PlotRange -> All does not achieve this. Why does All not include all of the data in this case?

For Example:

x = Range[0.001, 1000];
y = 5 - Log[x];
ListPlot[Transpose[{x, y}], PlotRange -> All]
ListLogLinearPlot[Transpose[{x, y}], PlotRange -> All]

In the resulting plots, the ListPlot looks as expected:

listplot

but the LisLogLinearPlot cuts off several points on the left:

listloglinearplot

share|improve this question
2  
ListLogLinearPlot[Transpose[{x, y}], PlotRange -> {Full, All}, Frame -> True] will work too. –  Kuba May 6 at 22:25
    
appears to be fixed in V10 (OS X 10.9.4) –  Mike Honeychurch Jul 16 at 2:38

3 Answers 3

up vote 3 down vote accepted

Update for version 10.0.0

The bug in how ListLogLinearPlot calculates explicit value for PlotRange -> All was finally fixed in version 10.0.0 (July 2014). But the underlying principle is still the same: instead of just passing PlotRange -> All for the FrontEnd it calculates explicit value of the plot range in the Kernel. The calculated value differs from the one selected by the FrontEnd which can be obtained using the plotRange function:

x = Range[0.001, 1000];
y = 5 - Log[x];
pl = ListLogLinearPlot[Transpose[{x, y}], PlotRange -> All];
PlotRange /. Options[pl, PlotRange]
plotRange[Show[pl, PlotRange -> All]]
{{-7.19556, 6.90676}, {-1.90676, 11.9078}}
{{-7.41591, 6.90676}, {-1.90676, 11.9078}}

Original answer

There already was a discussion of this issue on MathGroups three years ago. Darren Glosemeyer (Wolfram Research) confirmed that this is a bug:

The fact that All does not show all the points is a bug in the log-based plotting code which I think will be fixed in the next release.

I get confused about the difference between All and Full as well. I'm told by the developer of PlotRange that PlotRange->Full uses the PlotRange->All result and then does some clipping. The clipping is similar (at least in concept and perhaps even in the internal code) to a applying a RegionFunction. So there is a difference between All and Full, but it's somewhat subtle (more subtle than I completely understand).

Darren Glosemeyer

Wolfram Research

The bug becomes clear if one checks the value of PlotRange of the plot generated:

x = Range[0.001, 1000];
y = 5 - Log[x];
pl = ListLogLinearPlot[Transpose[{x, y}], PlotRange -> All, 
   Frame -> True, Axes -> False];
Options[pl, PlotRange]    

{PlotRange -> {{2.8389, 6.90676}, {-1.90676, 11.9078}}}

It is not All as it should. To fix this one needs to reset PlotRange to All again:

pl2 = Show[pl, PlotRange -> All]

plot

Using plotRange function from this answer one can determine absolute value for PlotRange -> All (without PlotRangePadding):

plotRange[pl2]    
{{-6.90776, 6.90676}, {-1.90676, 11.9078}}

One can see that it is substantiantly wider than the value generated by ListLogLinearPlot. So it is clearly a bug in how ListLogLinearPlot handles PlotRange -> All. It basically has the same nature as the bug in handling AspectRatio -> Automatic by TreePlot: in the both cases the developer tries to calculate in the Kernel absolute value for a Dynamic option which by definition can be handled only by FrontEnd and get predictable failure on this way.

share|improve this answer

I've plotted quite a lot... and I still don't know what's the difference...

All -> all points are included

Full -> include full range of original data

Clearly, All behaves here as Automatic:

Automatic -> outlying points are dropped

I've thought, maybe "all points" refers to the precalculated list of points, but the outlier is there, even if invisible:

ListLogLinearPlot[Transpose[{x, y}], PlotRange -> All, Frame -> True
  ] // {#, Cases[#, Point[x_] :> E^x[[1, 1]], ∞]} &

enter image description here

For me it's clearly a bug or problem with docs that should stress:

if you need All the data, use Full. :)

 ListLogLinearPlot[Transpose[{x, y}], PlotRange -> Full, Frame -> True]

enter image description here

share|improve this answer
2  
So if you need All the data you use Full. But do you use All if you need the Full set of data? :D –  Öskå May 6 at 23:04
2  
@Öskå But are you sure you want full set, not all the data? :p –  Kuba May 6 at 23:05
1  
I'm not sure anymore :( :D –  Öskå May 6 at 23:06

It's the automatic value of the option PlotRangePadding, not the PlotRange option, that's causing the problem in the ListLogPlot. The default Automatic value adds 4% to end-point values of the range. This is nowhere enough for the ListLogPlot with its extreme range.

All that is needed are user-specified values for the plot range padding on the right- and left-hand sides of the plot.

x = Range[0.001, 1000];
y = 5 - Log[x];
ListLogLinearPlot[Transpose[{x, y}], 
  PlotRange -> All, PlotRangePadding -> {{10., .1}, Automatic}]

plot

share|improve this answer
    
But if you have 4% more than All range it should still show all the points, shouldn't it? –  Kuba May 7 at 6:06
    
@kuba. I think the 4% is based on the scaled dimensions of the viewport and not on the plot metric. I'm guessing, but it's the only thing I can think that explains the observed behavior, including why the fix I propose works. –  m_goldberg May 7 at 6:15
    
@m_goldberg I think it is a bug in handling PlotRange->All and not in PlotRangePadding. See my answer for details. –  Alexey Popkov May 7 at 8:26

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.