@@ -1083,13 +1083,14 @@ def hlines(self, y, xmin, xmax, colors=None, linestyles='solid',
10831083 lines ._internal_update (kwargs )
10841084
10851085 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 ])
10911093 corners = (minx , miny ), (maxx , maxy )
1092-
10931094 self .update_datalim (corners )
10941095 self ._request_autoscale_view ()
10951096
@@ -1162,11 +1163,13 @@ def vlines(self, x, ymin, ymax, colors=None, linestyles='solid',
11621163 lines ._internal_update (kwargs )
11631164
11641165 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 ])
11701173 corners = (minx , miny ), (maxx , maxy )
11711174 self .update_datalim (corners )
11721175 self ._request_autoscale_view ()
0 commit comments