We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d91d216 commit bbe738fCopy full SHA for bbe738f
lib/matplotlib/axes/_axes.py
@@ -3756,8 +3756,12 @@ def apply_mask(arrays, mask):
3756
f"'{dep_axis}err' must not contain None. "
3757
"Use NaN if you want to skip a value.")
3758
3759
- if np.any((err < -err) & (err == err)):
3760
- # like err<0, but also works for timedelta and nan.
+ # Raise if any errors are negative, but not if they are nan.
+ # 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):
3765
raise ValueError(
3766
f"'{dep_axis}err' must not contain negative values")
3767
# This is like
0 commit comments