@@ -3368,7 +3368,7 @@ def xywhere(xs, ys, mask):
3368
3368
ys = [thisy for thisy , b in zip (ys , mask ) if b ]
3369
3369
return xs , ys
3370
3370
3371
- def extract_err (err , data ):
3371
+ def extract_err (name , err , data ):
3372
3372
"""
3373
3373
Private function to parse *err* and subtract/add it to *data*.
3374
3374
@@ -3380,20 +3380,9 @@ def extract_err(err, data):
3380
3380
iter (b )
3381
3381
except (TypeError , ValueError ):
3382
3382
a = b = err # Symmetric error: 1D iterable.
3383
- # This could just be `np.ndim(a) > 1 and np.ndim(b) > 1`, except
3384
- # for the (undocumented, but tested) support for (n, 1) arrays.
3385
- a_sh = np .shape (a )
3386
- b_sh = np .shape (b )
3387
- if (len (a_sh ) > 2 or (len (a_sh ) == 2 and a_sh [1 ] != 1 )
3388
- or len (b_sh ) > 2 or (len (b_sh ) == 2 and b_sh [1 ] != 1 )):
3383
+ if np .ndim (a ) > 1 or np .ndim (b ) > 1 :
3389
3384
raise ValueError (
3390
- "err must be a scalar or a 1D or (2, n) array-like" )
3391
- if len (a_sh ) == 2 or len (b_sh ) == 2 :
3392
- cbook .warn_deprecated (
3393
- "3.1" , message = "Support for passing a (n, 1)-shaped error "
3394
- "array to errorbar() is deprecated since Matplotlib "
3395
- "%(since)s and will be removed %(removal)s; pass a 1D "
3396
- "array instead." )
3385
+ f"{ name } err must be a scalar or a 1D or (2, n) array-like" )
3397
3386
# Using list comprehensions rather than arrays to preserve units.
3398
3387
for e in [a , b ]:
3399
3388
if len (data ) != len (e ):
@@ -3405,7 +3394,7 @@ def extract_err(err, data):
3405
3394
return low , high
3406
3395
3407
3396
if xerr is not None :
3408
- left , right = extract_err (xerr , x )
3397
+ left , right = extract_err ('x' , xerr , x )
3409
3398
# select points without upper/lower limits in x and
3410
3399
# draw normal errorbars for these points
3411
3400
noxlims = ~ (xlolims | xuplims )
@@ -3454,7 +3443,7 @@ def extract_err(err, data):
3454
3443
** eb_cap_style ))
3455
3444
3456
3445
if yerr is not None :
3457
- lower , upper = extract_err (yerr , y )
3446
+ lower , upper = extract_err ('y' , yerr , y )
3458
3447
# select points without upper/lower limits in y and
3459
3448
# draw normal errorbars for these points
3460
3449
noylims = ~ (lolims | uplims )
0 commit comments