Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ec1da3b

Browse files
committed
add check when two inputs have negative numbers
1 parent de1e5ba commit ec1da3b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3283,9 +3283,13 @@ def errorbar(self, x, y, yerr=None, xerr=None,
32833283
x, y = np.atleast_1d(x, y) # Make sure all the args are iterable.
32843284
if len(x) != len(y):
32853285
raise ValueError("'x' and 'y' must have the same size")
3286-
3286+
32873287
if xerr is not None and np.any(xerr < 0):
3288-
raise ValueError("'xerr' must have positive numbers")
3288+
if yerr is not None and np.any(yerr < 0):
3289+
raise ValueError(
3290+
"'xerr' and 'yerr' must have positive numbers")
3291+
else:
3292+
raise ValueError("'xerr' must have positive numbers")
32893293
if yerr is not None and np.any(yerr < 0):
32903294
raise ValueError("'yerr' must have positive numbers")
32913295

0 commit comments

Comments
 (0)