Group Abstract Group Abstract

Message Boards Message Boards

1
|
7.8K Views
|
6 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Why does ListPlot change when option is given explicitly?

Attachments:
POSTED BY: Otto Linsuain
6 Replies
POSTED BY: Otto Linsuain

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.:

enter image description here

Regards -- Henrik

POSTED BY: Henrik Schachner

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.

POSTED BY: Otto Linsuain

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

POSTED BY: Otto Linsuain

But why don't you set it yourself to the same value? Either in Scaled or none-scaled units?

POSTED BY: Sander Huisman

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]
POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard