Fix traceback for vlines/hlines, when an empty list or array passed in for x/y. #1000

Merged
merged 3 commits into from Jul 10, 2012
View
@@ -3626,15 +3626,16 @@ def hlines(self, y, xmin, xmax, colors='k', linestyles='solid',
self.add_collection(coll)
coll.update(kwargs)
- minx = min(xmin.min(), xmax.min())
- maxx = max(xmin.max(), xmax.max())
- miny = y.min()
- maxy = y.max()
+ if len(y) > 0:
+ minx = min(xmin.min(), xmax.min())
+ maxx = max(xmin.max(), xmax.max())
+ miny = y.min()
+ maxy = y.max()
- corners = (minx, miny), (maxx, maxy)
+ corners = (minx, miny), (maxx, maxy)
- self.update_datalim(corners)
- self.autoscale_view()
+ self.update_datalim(corners)
+ self.autoscale_view()
return coll
@@ -3706,16 +3707,17 @@ def vlines(self, x, ymin, ymax, colors='k', linestyles='solid',
linestyles=linestyles, label=label)
self.add_collection(coll)
coll.update(kwargs)
+
+ if len(x) > 0:
+ minx = min( x )
+ maxx = max( x )
- minx = min( x )
- maxx = max( x )
-
- miny = min( min(ymin), min(ymax) )
- maxy = max( max(ymin), max(ymax) )
+ miny = min( min(ymin), min(ymax) )
+ maxy = max( max(ymin), max(ymax) )
- corners = (minx, miny), (maxx, maxy)
- self.update_datalim(corners)
- self.autoscale_view()
+ corners = (minx, miny), (maxx, maxy)
+ self.update_datalim(corners)
+ self.autoscale_view()
return coll