@@ -1083,10 +1083,10 @@ def hlines(self, y, xmin, xmax, colors=None, linestyles='solid',
1083
1083
lines ._internal_update (kwargs )
1084
1084
1085
1085
if len (y ) > 0 :
1086
- minx = min (xmin . min ( ), xmax . min ( ))
1087
- maxx = max (xmin . max ( ), xmax . max ( ))
1088
- miny = y . min ( )
1089
- maxy = y . max ( )
1086
+ minx = min (np . nanmin ( xmin ), np . nanmin ( xmax ))
1087
+ maxx = max (np . nanmax ( xmin ), np . nanmax ( xmax ))
1088
+ miny = np . nanmin ( y )
1089
+ maxy = np . nanmax ( y )
1090
1090
1091
1091
corners = (minx , miny ), (maxx , maxy )
1092
1092
@@ -1162,10 +1162,10 @@ def vlines(self, x, ymin, ymax, colors=None, linestyles='solid',
1162
1162
lines ._internal_update (kwargs )
1163
1163
1164
1164
if len (x ) > 0 :
1165
- minx = x . min ( )
1166
- maxx = x . max ( )
1167
- miny = min (ymin . min ( ), ymax . min ( ))
1168
- maxy = max (ymin . max ( ), ymax . max ( ))
1165
+ minx = np . nanmin ( x )
1166
+ maxx = np . nanmax ( x )
1167
+ miny = min (np . nanmin ( ymin ), np . nanmin ( ymax ))
1168
+ maxy = max (np . nanmax ( ymin ), np . nanmax ( ymax ))
1169
1169
1170
1170
corners = (minx , miny ), (maxx , maxy )
1171
1171
self .update_datalim (corners )
@@ -2674,7 +2674,7 @@ def sign(x):
2674
2674
extrema = max (x0 , x1 ) if dat >= 0 else min (x0 , x1 )
2675
2675
length = abs (x0 - x1 )
2676
2676
2677
- if err is None :
2677
+ if err is None or np . size ( err ) == 0 :
2678
2678
endpt = extrema
2679
2679
elif orientation == "vertical" :
2680
2680
endpt = err [:, 1 ].max () if dat >= 0 else err [:, 1 ].min ()
@@ -3504,7 +3504,9 @@ def apply_mask(arrays, mask): return [array[mask] for array in arrays]
3504
3504
f"'{ dep_axis } err' (shape: { np .shape (err )} ) must be a "
3505
3505
f"scalar or a 1D or (2, n) array-like whose shape matches "
3506
3506
f"'{ dep_axis } ' (shape: { np .shape (dep )} )" ) from None
3507
- if np .any (err < - err ): # like err<0, but also works for timedelta.
3507
+ res = np .zeros_like (err , dtype = bool ) # Default in case of nan
3508
+ if np .any (np .less (err , - err , out = res , where = (err == err ))):
3509
+ # like err<0, but also works for timedelta and nan.
3508
3510
raise ValueError (
3509
3511
f"'{ dep_axis } err' must not contain negative values" )
3510
3512
# This is like
0 commit comments