Skip to content

Commit

Permalink
Handle the edge case in matplotlib.axes.vlines, where an empty list o…
Browse files Browse the repository at this point in the history
…r array is passed in as x. Previously,

the vlines routine would raise an exception when min(x) was called, if x was an empty list.wq
  • Loading branch information
dhyams committed Jul 10, 2012
1 parent 2bb91ce commit 8f50a76
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/matplotlib/axes.py
Expand Up @@ -3706,16 +3706,17 @@ def vlines(self, x, ymin, ymax, colors='k', linestyles='solid',
linestyles=linestyles, label=label) linestyles=linestyles, label=label)
self.add_collection(coll) self.add_collection(coll)
coll.update(kwargs) coll.update(kwargs)

if len(x) > 0:
minx = min( x )
maxx = max( x )


minx = min( x ) miny = min( min(ymin), min(ymax) )
maxx = max( x ) maxy = max( max(ymin), max(ymax) )


miny = min( min(ymin), min(ymax) ) corners = (minx, miny), (maxx, maxy)
maxy = max( max(ymin), max(ymax) ) self.update_datalim(corners)

self.autoscale_view()
corners = (minx, miny), (maxx, maxy)
self.update_datalim(corners)
self.autoscale_view()


return coll return coll


Expand Down

0 comments on commit 8f50a76

Please sign in to comment.