[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #63033] "axis tight" includes x-data in limit
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #63033] "axis tight" includes x-data in limit calculation for which the y-data is NaN |
Date: |
Thu, 15 Sep 2022 20:22:51 -0400 (EDT) |
Update of bug #63033 (project octave):
Severity: 3 - Normal => 1 - Wish
Priority: 5 - Normal => 3 - Low
Status: None => Confirmed
Release: 7.2.0 => dev
Operating System: Microsoft Windows => Any
Summary: axis tight does not ignore NaN => "axis tight"
includes x-data in limit calculation for which the y-data is NaN
_______________________________________________________
Follow-up Comment #1:
Confirmed. Re-titling the bug report to be more precise about the issue.
Sample code
figure
plot (1:10, [1:9, NaN])
axis tight
The explanation is rather simple. When Octave calculates limits for "axis
tight" it looks at each axis individually. In the sample code, the x-data has
a minimum of 1 and a maximum of 10 so that is what Octave sets the axis limits
to. Apparently Matlab also checks whether the corresponding y-value is
finite. I tried two variations in Matlab and the limit is 9 in each case.
plot (1:10, [1:9, NaN])
plot (1:10, [1:9, Inf])
But, things aren't always straightforward even in Matlab. This code produces
a line at 45 degrees from 1:9. There are no line segments after x == 9, and
yet the limits of the plot are set at 1 and 11.
figure
plot (1:11, [1:9, NaN, 9])
axis tight
I know why it does that, but it still seems odd since there is no visual data
past 9.
Marking as a low priority since there are easy workarounds such as calling
xlim or axis with limits that look good to the programmer.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?63033>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/