Specifying ecolor for errorbar plot doesn't allow color cycling

When I specify an ecolor parameter in an errorbar plot, the resulting graph doesn’t cycle through the differ colors in the plotted lines. See code below for example.

%matplotlib notebook
import matplotlib.pyplot as plt

# example data
x = np.arange(0.1, 4, 0.5)
y = np.exp(-x)

fig, (ax0, ax1) = plt.subplots(nrows=2, sharex=True)

for n in range(4):
    
    y = np.exp(x+n)
    my_error = y*0.25 
    
    ax0.errorbar(x, y, yerr=my_error, linestyle='-', marker='o', label=n,   ) # Wihtout specifying ecolor 
    ax1.errorbar(x, y, yerr=my_error, linestyle='-', marker='o', label=n, ecolor='black'   ) # WIth specifying ecolor

ax0.set_title('WORKING as expected: Each plotted should cycle through colors')    
ax1.set_title('ISSUE: Each plotted line is same color instead of cycling through colors')    
ax0.legend()
ax1.legend()

plt.show()
1 Like

Thanks for reporting this, it’s totally a bug and I’ve opened an issue to track it https://github.com/matplotlib/matplotlib/issues/16593

1 Like

It’s now fixed in master, thanks for the report!

1 Like

Thank you! Glad I helped finding a bug :slight_smile:

1 Like