Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Handled edge case for hlines also; if y is an empty list or zero-leng…

…th array, the routine

would raise an exception.
  • Loading branch information...
commit 554bd483cad7728655c830607bba65929dd052af 1 parent 8f50a76
@dhyams authored
Showing with 8 additions and 7 deletions.
  1. +8 −7 lib/matplotlib/axes.py
View
15 lib/matplotlib/axes.py
@@ -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(x) > 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
Please sign in to comment.
Something went wrong with that request. Please try again.