Skip to content

Commit

Permalink
closes #16593 setting ecolor turns off color cycling
Browse files Browse the repository at this point in the history
Co-authored-by: tacaswell <tcaswell@gmail.com>

flake errors
  • Loading branch information
story645 committed Feb 28, 2020
1 parent 3b04c7d commit dc16c70
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/matplotlib/axes/_axes.py
Expand Up @@ -3215,8 +3215,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
# Remove alpha=0 color that _process_plot_format returns
fmt_style_kwargs.pop('color')

if ('color' in kwargs or 'color' in fmt_style_kwargs or
ecolor is not None):
if ('color' in kwargs or 'color' in fmt_style_kwargs):
base_style = {}
if 'color' in kwargs:
base_style['color'] = kwargs.pop('color')
Expand All @@ -3227,6 +3226,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
base_style.update(fmt_style_kwargs)
if 'color' not in base_style:
base_style['color'] = 'C0'
color = 'C0'
if ecolor is None:
ecolor = base_style['color']
# make sure all the args are iterable; use lists not arrays to
Expand Down
15 changes: 15 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Expand Up @@ -3157,6 +3157,21 @@ def test_errorbar_colorcycle():
assert mcolors.to_rgba(ln1.get_color()) == mcolors.to_rgba('C2')


@check_figures_equal()
def test_errorbar_cycle_ecolor(fig_test, fig_ref):
x = np.arange(0.1, 4, 0.5)
y = [np.exp(-x+n) for n in range(4)]
axt = fig_test.subplots()
for yi in y:
axt.errorbar(x, yi, yerr=(yi * 0.25), linestyle='-',
marker='o', ecolor='black')

axr = fig_ref.subplots()
for yi, color in zip(y, ['C0', 'C1', 'C2', 'C3']):
axr.errorbar(x, yi, yerr=(yi * 0.25), linestyle='-',
marker='o', color=color, ecolor='black')


def test_errorbar_shape():
fig = plt.figure()
ax = fig.gca()
Expand Down

0 comments on commit dc16c70

Please sign in to comment.