You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: sticky edge related changes for datetime plots #28567
Having just picked up v3.9.1, we are seeing downstream image test failures due to additional whitespace in contourf and pcolor plots that use datetimes. The change bisects to #28393.
It seems like, by the time we get the the relevant comparison, somehow the sticky limits got flipped:
diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py
index 4606e5c01a..9d5274d9e6 100644
--- a/lib/matplotlib/axes/_base.py+++ b/lib/matplotlib/axes/_base.py@@ -2969,12 +2969,14 @@ class _AxesBase(martist.Artist):
# Index of largest element < x0 + tol, if any.
i0 = stickies.searchsorted(x0 + tol) - 1
x0bound = stickies[i0] if i0 != -1 else None
+ print(f'{x0bound=}, {x0=}')
# Ensure the boundary acts only if the sticky is the extreme value
if x0bound is not None and x0bound > x0:
x0bound = None
# Index of smallest element > x1 - tol, if any.
i1 = stickies.searchsorted(x1 - tol)
x1bound = stickies[i1] if i1 != len(stickies) else None
+ print(f'{x1bound=}, {x1=}')
# Ensure the boundary acts only if the sticky is the extreme value
if x1bound is not None and x1bound < x1:
x1bound = None
So I guess the problem is basically the same as #28223 in that the data range is less than the tolerance. If I make the tolerance only a function of the range
tol=1e-5*abs(x1-x0)
as suggested at #28393 (comment), this is fixed and no existing tests break.
Yeah, I came to the same conclusion... I think that works, and makes more sense to me... I can't think of a case where the absolute magnitude is preferred to the range of the data for this computation.
Activity
[-][Bug]: sticky-related changes for datetime plots[/-][+][Bug]: sticky edge related changes for datetime plots[/+]rcomer commentedon Jul 14, 2024
If I get hold of the contourset and the axes here, I have
😕
rcomer commentedon Jul 14, 2024
It seems like, by the time we get the the relevant comparison, somehow the sticky limits got flipped:
rcomer commentedon Jul 14, 2024
So I guess the problem is basically the same as #28223 in that the data range is less than the tolerance. If I make the tolerance only a function of the range
as suggested at #28393 (comment), this is fixed and no existing tests break.
ksunden commentedon Jul 14, 2024
Yeah, I came to the same conclusion... I think that works, and makes more sense to me... I can't think of a case where the absolute magnitude is preferred to the range of the data for this computation.