# Why does ListPlot change when option is given explicitly?

GROUPS:
 Otto Linsuain 1 Vote Hello,I am trying to understand the unexpected result of this simple code (using version 11.0.0.0 student edition): a = ListPlot[Table[{x, x}, {x, 1, 5, 0.01}]] AbsoluteOptions[a, PlotRange] AbsoluteOptions[a, PlotRangePadding] b = ListPlot[Table[{x, x}, {x, 1, 5, 0.01}], %[[1]]] AbsoluteOptions[b, PlotRange] AbsoluteOptions[b, PlotRangePadding] Basically, plot b is the same as plot a, except I explicitly enter the default option used in plot a for plot range padding.The result is that the plot range changes. For plot a the plot range was (1,5) for x and (0,5) for y, and for plot b the plot range is (1,5) for both axes. See attached file.The value for plot range padding does not change (scaled 0.02, 0.02, 0.02, and 0.05).The actual graphs printed are also different. In a the y axis starts at zero, so there is a band with no data (y from zero to one). For b the y axis starts at 1, and the x axis gets cut off in the printed result (this almost qualifies as a bug for me).Ultimately what I am trying to do is to get the ListPlot to include all the points in the plot range (PlotRange -> All or Full), but to not add extra space differently for the x and y axes. I don't mind some padding, just don't like the difference in x and y. Basically, when I plot the same list on x and y, I want to see it go in a corner-to-corner direction, similar to the result of Plot[x,{x,1,5}].Thanks in advance,Otto Linsuaín Attachments:
Answer
4 months ago
6 Replies
 You need the answer before that: a = ListPlot[Table[{x, x}, {x, 1, 5, 0.01}]] AbsoluteOptions[a, PlotRange] AbsoluteOptions[a, PlotRangePadding] b = ListPlot[Table[{x, x}, {x, 1, 5, 0.01}], %%[[1]]] (* notice the double percent here *) AbsoluteOptions[b, PlotRange] AbsoluteOptions[b, PlotRangePadding] 
Answer
4 months ago
 Hello Sander,Thanks for replying to my post. I think I mean to use the PlotRangePadding option (one percent sign).If I set plot b to be the same as a, but implicitly entering the PlotRange option that a used, then I think nothing happens, and plot b will look the same as plot a as it should be (although strangely enough, in that case the value for PlotRangePadding changes).But my point remains as originally stated. If I use in plot b the value of PlotRangePadding that a used, then the plot changes. Apparently, entering an implicit value for one of these options changes the other. In either case I do not get the result I wanted, which is to use the same padding in y as used in x.Thanks,Otto Linsuaín
Answer
4 months ago
 But why don't you set it yourself to the same value? Either in Scaled or none-scaled units?
Answer
4 months ago
 The most common reason in programming: not known in advance!I suppose I could code something like PlotRange-> {Min[data],Max[data]} (I have done it that before) and PlotRangePadding-> some small number (never dealt with it). And then perhaps also ensure I get nice round numbers for the ticks. It almost feels like I am working around a deficiency.This all came about from me noticing that Plot[x,{x,1,5}] draws a line from corner to corner, but ListPlot[Table[{x,x},{x,1,5,0.01}]] does not. They use different defaults for deciding the ranges. It is a bit annoying for what I am doing, even if it is not the end of the world.I suppose it is not that big a deal, because for any individual graph one can always fix it by hand, as you point out. It is just a nuisance that the default behavior treats x and y differently. Add to that the fact that entering the same value of the option changes the result (and even cuts off one axis), and one can almost call it a bug.Thanks,Otto.
Answer
4 months ago
 Henrik Schachner 1 Vote Hi Otto,I can confirm the effect you are describing (my system: 11.0.1 for Linux x86 (64-bit) (September 21, 2016)) and I find this a "strange behavior" indeed. As result of AbsoluteOptions I would expect some absolute value, not some scaled - the documentation seems to indicate the same! Interestingly this appears to be different (i.e. OK) in older versions, e.g.:Regards -- Henrik
Answer
4 months ago
 Hello Henrik,Thanks for your reply. Sorry I did not read it earlier, sort of got disconnected from this post. I just opened this post because I saw the same thing you display for version 9, it works fine! (mine is in Linux). So, something got broken between 9 and 11. If I remember right (don't have it in front of me) in version 11 in the second graph the x-axis is at y=1, but does not show in the graph at all.It is very interesting that version 9 gets it right. There must be a flag one can reset to what it used to be. I may give it a try when I get home, I may open them side by side (I have access to different versions from different computers) and see if the options show any difference.Best,Otto.
Answer
3 months ago