@@ -1060,13 +1060,14 @@ def hlines(self, y, xmin, xmax, colors=None, linestyles='solid',
1060
1060
lines .update (kwargs )
1061
1061
1062
1062
if len (y ) > 0 :
1063
- minx = min (xmin .min (), xmax .min ())
1064
- maxx = max (xmin .max (), xmax .max ())
1065
- miny = y .min ()
1066
- maxy = y .max ()
1067
-
1063
+ # Extreme values of xmin/xmax/y. Using masked_verts here handles
1064
+ # the case of y being a masked *object* array (as can be generated
1065
+ # e.g. by errorbar()), which would make nanmin/nanmax stumble.
1066
+ minx = np .nanmin (masked_verts [..., 0 ])
1067
+ maxx = np .nanmax (masked_verts [..., 0 ])
1068
+ miny = np .nanmin (masked_verts [..., 1 ])
1069
+ maxy = np .nanmax (masked_verts [..., 1 ])
1068
1070
corners = (minx , miny ), (maxx , maxy )
1069
-
1070
1071
self .update_datalim (corners )
1071
1072
self ._request_autoscale_view ()
1072
1073
@@ -1139,11 +1140,13 @@ def vlines(self, x, ymin, ymax, colors=None, linestyles='solid',
1139
1140
lines .update (kwargs )
1140
1141
1141
1142
if len (x ) > 0 :
1142
- minx = x .min ()
1143
- maxx = x .max ()
1144
- miny = min (ymin .min (), ymax .min ())
1145
- maxy = max (ymin .max (), ymax .max ())
1146
-
1143
+ # Extreme values of x/ymin/ymax. Using masked_verts here handles
1144
+ # the case of x being a masked *object* array (as can be generated
1145
+ # e.g. by errorbar()), which would make nanmin/nanmax stumble.
1146
+ minx = np .nanmin (masked_verts [..., 0 ])
1147
+ maxx = np .nanmax (masked_verts [..., 0 ])
1148
+ miny = np .nanmin (masked_verts [..., 1 ])
1149
+ maxy = np .nanmax (masked_verts [..., 1 ])
1147
1150
corners = (minx , miny ), (maxx , maxy )
1148
1151
self .update_datalim (corners )
1149
1152
self ._request_autoscale_view ()
0 commit comments