# Mathematica 10, Show, and PlotRange

I have recently moved from Mathematica 8 to Mathematica 10, however I'm having a problem with PlotRange->All in combination with Show[].

For example,

Show[Table[ListPlot[{{i,i^2}},PlotRange->All],{i,1,10}]]


only shows the first point in Mathematica 10, but all data points are shown in Mathematica 8.

I have tried suggested solutions such as PlotRangePadding but to no avail. Any suggestions?

• What does the InputForm[] of the version 10 plot look like? – J. M. will be back soon Jul 30 '15 at 12:08
• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory Tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. – bbgodfrey Jul 30 '15 at 12:09

When different plots use conflicting options, Show uses the first one listed. So, here it is using the PlotRange of the first graphics instance. Use

Show[Table[ListPlot[{{i, i^2}}], {i, 1, 10}], PlotRange -> All]


instead to see all the points.

Further Explanation

To see more clearly what is happening, consider the InputForm (as suggested by Guesswhoitis) of the first Plot.

With[{i = 1}, ListPlot[{{i, i^2}}, PlotRange -> All]] // InputForm


The output contains PlotRange -> {{0, 2.}, {0, 2.}}, which is how Plot translates PlotRange -> All for the single point given. For another of the plots, say i = 10, it gives as part of the output, PlotRange -> {{0, 20.}, {0, 200.}}. With these conflicting expressions for PlotRange, Show chooses the first one given, namely the one for i = 1. As it happens, this small range includes only the first i value of the ten desired. The solution above is to give the option PlotRange directly to Show, overriding any definitions from the individual plots. This explanation applies to any number of other Graphics options.

• I hadn't realised that Show[] could execute the PlotRange command. Thank you for your help. Regards Adam – Adam Williams Jul 30 '15 at 14:37
• It's not immediately obvious to know that: Options[Show] yields an empty list of options; and the doc page for Show lists just a single option, namely, DisplayFunction. However the Details section of the page for Show does state, "Show allows any option that can be applied to graphics to be given." – murray Jul 30 '15 at 22:00
• @Adam, your take-away from this should be "Show[] can be used to override previously set or default settings of Graphics[] or Graphics3D[]". – J. M. will be back soon Jul 30 '15 at 22:19
• @Guesswhoitis. This is another new-in-10 change to how graphics options work. OP's code works fine in V9. – Michael E2 Jul 30 '15 at 22:35
• @Michael, I see… now that's quite annoying. I wonder if anyone's complained to WRI about this new behavior. – J. M. will be back soon Jul 30 '15 at 22:39

This is complementary to bbgodfrey's answer:

PlotRange is an option for Graphics, and PlotRange -> All means "show everything". All the options that can be given in Graphics can also be given in plotting functions such as ListPlot, Plot, etc. Usually, they have the same meaning as in Graphics, but there are exceptions. PlotRange is a fairly subtle exception.

In plotting functions, PlotRange controls the range of computed results to be included in the plot, and does not directly translate to the PlotRange option of Graphics.

For example,

DensityPlot[x^2 + y^2, {x, -1, 1}, {y, -1, 1}, PlotRange -> {0, 1}]


Compare this with generating the graphics first, then setting PlotRange within the resulting Graphics option

Show[%, PlotRange -> {0, 1}]


You can see that it did something quite different. In DensityPlot it controlled the colour range, which is closely related to what this particular plotting function actually does. In Graphics, it just set the vertical coordinate range.

What does Show do? Since version 6, it has two main functions:

• Set options in existing Graphics objects, like I did above.
• Combine several graphics into one. In this case the options are inherited from the first one.

What happens in your case is that PlotRange -> All causes ListPlot to figure out a vertical range on its own, and set it explicitly as PlotRange -> {0., 2.} in the Graphics object it creates. The rest is explained in the other answer.

• Ah, yes, PlotRange has to be carefully tested precisely because it is only partially passed through to Graphics. :P +1 – rcollyer Jul 31 '15 at 12:01