Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5a7c3a3

Browse files
committed
Fix exception plotting an errorbar graph with only two data points.
svn path=/trunk/matplotlib/; revision=4194
1 parent 0c56410 commit 5a7c3a3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/matplotlib/axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3717,7 +3717,7 @@ def xywhere(xs, ys, mask):
37173717
plot_kw['mew']=kwargs['mew']
37183718

37193719
if xerr is not None:
3720-
if iterable(xerr) and len(xerr)==2:
3720+
if iterable(xerr) and len(xerr)==2 and iterable(xerr[0]) and iterable(xerr[1]):
37213721
# using list comps rather than arrays to preserve units
37223722
left = [thisx-thiserr for (thisx, thiserr) in cbook.safezip(x,xerr[0])]
37233723
right = [thisx+thiserr for (thisx, thiserr) in cbook.safezip(x,xerr[1])]
@@ -3751,7 +3751,7 @@ def xywhere(xs, ys, mask):
37513751
caplines.extend( self.plot(right, y, 'k|', **plot_kw) )
37523752

37533753
if yerr is not None:
3754-
if iterable(yerr) and len(yerr)==2:
3754+
if iterable(yerr) and len(yerr)==2 and iterable(yerr[0]) and iterable(yerr[1]):
37553755
# using list comps rather than arrays to preserve units
37563756
lower = [thisy-thiserr for (thisy, thiserr) in cbook.safezip(y,yerr[0])]
37573757
upper = [thisy+thiserr for (thisy, thiserr) in cbook.safezip(y,yerr[1])]

0 commit comments

Comments
 (0)