# How to set PlotRange->All for data with uncertainties and prevent cropping of error bars?

Mathematica 12 introduces built-in plotting support for data with errorbars.

The following example looks good with the default settings:

ListPlot[Table[Around[i, 5], {i, 10}]] However, when I set PlotRange->All, the error bars get cropped:

ListPlot[Table[Around[i, 5], {i, 10}], PlotRange -> All] Here is an example, where default PlotRange crops error bars:

ListPlot[{Table[{i, Around[1/i, {-10, 10}]}, {i, -5.5, 5.5, 1.0}],
Table[{i, 3 i}, {i, 0.5, 5.5, 1.0}]}] and adding PlotRange->All does not help either:

ListPlot[{Table[{i, Around[1/i, {-10, 10}]}, {i, -5.5, 5.5, 1.0}],
Table[{i, 3 i}, {i, 0.5, 5.5, 1.0}]},
PlotRange -> All] Is there a universal option to get the full PlotRange for any data with error bars?

A work-around: use Show with the option PlotRange -> All:

Show[ListPlot[Table[Around[i, 5], {i, 10}]], PlotRange -> All] Show[ListPlot[{Table[{i, Around[1/i, {-10, 10}]}, {i, -5.5, 5.5, 1.0}],
Table[{i, 3 i}, {i, 0.5, 5.5, 1.0}]}], PlotRange -> All] An alternative work-around is to use explicit range for the vertical axis:

tbl = Table[Around[i, 5], {i, 10}];
yrange = MinMax[#["Interval"]& /@ tbl];
ListPlot[tbl, PlotRange -> {Automatic, yrange}] For the second example:

tbl2 = {Table[{i, Around[1/i, {-10, 10}]}, {i, -5.5, 5.5, 1.0}],
Table[{i, 3 i}, {i, 0.5, 5.5, 1.0}]};
yrange2 = MinMax @ Flatten[tbl2[[All, All, 2]] /. a_Around :> MinMax[ a["Interval"]]];
ListPlot[tbl2, PlotRange -> {Automatic, yrange2}] It seems that if one replaces the PlotRange option in the resulting graphics expression by PlotRange->All, all works out. The resulting Graphics from

ListPlot[Table[Around[i, 5], {i, 10}],PlotRange -> All]


(if one inspects it via InputForm) has an explicit set of plot ranges

PlotRange -> {{0.8125000000000003, 10.}, {0, 10.}}


But replacing that with PlotRange->All explicitly the wished-for graphic is obtained

ListPlot[Table[Around[i, 5], {i, 10}],
PlotRange -> All] /. (PlotRange -> _) :> (PlotRange -> All)


This seems to be a bug. For example if one evaluates a simple plot

Plot[x, {x, 0, 5}, PlotRange -> All] // InputForm


the PlotRange is

PlotRange -> {All, All}


and has not been transformed into an explicit numerical PlotRange. I will send in a bug report and see what the response is.

• In your final example of a simple plot, try usual procedure: PlotRange[Plot[x, {x, 0, 5}, PlotRange -> All]] and you will get explicit numerical intervals (without taking PlotRangePadding into account). And I think your variant with further replacing PlotRange is essentially what Show does. Nevertheless, very useful observations, +1. – Alx Aug 3 at 11:59
• Hi Alx, Cases[Plot[x,{x,0,5},PlotRange->All],z:(PlotRange->_):>z,Infinity] gives {PlotRange->{All,All}} and not an explicit numerical interval. Perhaps I misunderstood the first part of your comment though. BTW I checked with WRI bugs and submitted this -- it is likely related to a known bug that they are aware of. – David Reiss Aug 3 at 17:18
• I only meant that ususal way to know plotrange is PlotRange[<your Plot command here>] or undocumented get2DPlotRange from Charting context. – Alx Aug 3 at 23:57
• Ah, I didn't read your comment carefully enough! My appologies Alx. – David Reiss Aug 4 at 21:31