@@ -1060,13 +1060,14 @@ def hlines(self, y, xmin, xmax, colors=None, linestyles='solid',
10601060 lines .update (kwargs )
10611061
10621062 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 ])
10681070 corners = (minx , miny ), (maxx , maxy )
1069-
10701071 self .update_datalim (corners )
10711072 self ._request_autoscale_view ()
10721073
@@ -1139,11 +1140,13 @@ def vlines(self, x, ymin, ymax, colors=None, linestyles='solid',
11391140 lines .update (kwargs )
11401141
11411142 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 ])
11471150 corners = (minx , miny ), (maxx , maxy )
11481151 self .update_datalim (corners )
11491152 self ._request_autoscale_view ()
0 commit comments