8000 Fix traceback for vlines/hlines, when an empty list or array passed in for x/y. by dhyams · Pull Request #1000 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

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 1 commit
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
Prev Previous commit
Next Next commit
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
dhyams committed Jul 10, 2012
commit 554bd483cad7728655c830607bba65929dd052af
15 changes: 8 additions & 7 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(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
Expand Down
0