@@ -1083,13 +1083,14 @@ 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 (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
-
1086
+ # Extreme values of xmin/xmax/y. Using masked_verts here handles
1087
+ # the case of y being a masked *object* array (as can be generated
1088
+ # e.g. by errorbar()), which would make nanmin/nanmax stumble.
1089
+ minx = np .nanmin (masked_verts [..., 0 ])
1090
+ maxx = np .nanmax (masked_verts [..., 0 ])
1091
+ miny = np .nanmin (masked_verts [..., 1 ])
1092
+ maxy = np .nanmax (masked_verts [..., 1 ])
1091
1093
corners = (minx , miny ), (maxx , maxy )
1092
-
1093
1094
self .update_datalim (corners )
1094
1095
self ._request_autoscale_view ()
1095
1096
@@ -1162,11 +1163,13 @@ def vlines(self, x, ymin, ymax, colors=None, linestyles='solid',
1162
1163
lines ._internal_update (kwargs )
1163
1164
1164
1165
if len (x ) > 0 :
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
-
1166
+ # Extreme values of x/ymin/ymax. Using masked_verts here handles
1167
+ # the case of x being a masked *object* array (as can be generated
1168
+ # e.g. by errorbar()), which would make nanmin/nanmax stumble.
1169
+ minx = np .nanmin (masked_verts [..., 0 ])
1170
+ maxx = np .nanmax (masked_verts [..., 0 ])
1171
+ miny = np .nanmin (masked_verts [..., 1 ])
1172
+ maxy = np .nanmax (masked_verts [..., 1 ])
1170
1173
corners = (minx , miny ), (maxx , maxy )
1171
1174
self .update_datalim (corners )
1172
1175
self ._request_autoscale_view ()
0 commit comments