Visitar URL original
specifying ecolor in errobar turns off cycling · Issue #16593 · matplotlib/matplotlib · GitHub
The Wayback Machine - https://web.archive.org/web/20260106144700/https://github.com/matplotlib/matplotlib/issues/16593
Skip to content

specifying ecolor in errobar turns off cycling #16593

@story645

Description

@story645

As reported on discourse link by 01baftb When specifying 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.

image

%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()

Mpl should be cycling the underlying plot colors even though the error bar is specified.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions