Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 10, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions lib/matplotlib/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down