Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1000 from dhyams/fix_vlines

Fix traceback for vlines/hlines, when an empty list or array passed in for x/y.
  • Loading branch information...
commit f6b7f2849ce2557008c810b0cdcbcc0e1e5fcab3 2 parents 8c57e4f + d65269d
@WeatherGod WeatherGod authored
Showing with 17 additions and 15 deletions.
  1. +17 −15 lib/matplotlib/axes.py
View
32 lib/matplotlib/axes.py
@@ -3674,15 +3674,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
@@ -3752,16 +3753,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

0 comments on commit f6b7f28

Please sign in to comment.
Something went wrong with that request. Please try again.