Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bbe738f

Browse filesBrowse files
committed
BUG: ensure we never do nan < nan
1 parent d91d216 commit bbe738f
Copy full SHA for bbe738f

File tree

Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3756,8 +3756,12 @@ def apply_mask(arrays, mask):
37563756
f"'{dep_axis}err' must not contain None. "
37573757
"Use NaN if you want to skip a value.")
37583758

3759-
if np.any((err < -err) & (err == err)):
3760-
# like err<0, but also works for timedelta and nan.
3759+
# Raise if any errors are negative, but not if they are nan.
3760+
# To avoid nan comparisons (which lead to warnings on some
3761+
# platforms), we select with `err==err` (which is False for nan).
3762+
# Also, since datetime.timedelta cannot be compared with 0,
3763+
# we compare with the negative error instead.
3764+
if np.any((check := err[err == err]) < -check):
37613765
raise ValueError(
37623766
f"'{dep_axis}err' must not contain negative values")
37633767
# This is like

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.