Skip to content
Closed
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
14 changes: 14 additions & 0 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3211,6 +3211,20 @@ def errorbar(self, x, y, yerr=None, xerr=None,

if not np.iterable(y):
y = [y]
# The actual errorbar function works even if lengths of x and y
# dont matches with "ecolor" inorder to retain the same behavior
# the new change will only effect if lengths matches
if np.iterable(ecolor):
if len(ecolor) == len(x) and len(ecolor) == len(y):
# To get np.nan indices in both x and y lists
nan_indices = list(np.where(np.isnan(x))[
0]) + list(np.where(np.isnan(y))[0])
# To remove duplicates
nan_indices = list(set(nan_indices))
ecolor = np.array(ecolor)
# To delete colors corrresonding to np.nan in x and y
ecolor = np.delete(ecolor, nan_indices)
ecolor = list(ecolor)

if xerr is not None:
if not np.iterable(xerr):
Expand Down