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>
  • Loading branch information
story645 committed Feb 28, 2020
1 parent 9a24fb7 commit 56be9e1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 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
16 changes: 15 additions & 1 deletion lib/matplotlib/tests/test_axes.py
Expand Up @@ -3266,7 +3266,21 @@ def test_errorbar_offsets(fig_test, fig_ref):
ax_ref.errorbar(x[shift::4], y[shift::4], yerr[shift::4],
capsize=4, c=color, fmt='none')


@check_figures_equal()
def test_errorbar_ecolor_cycle(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')

@image_comparison(['hist_stacked_stepfilled', 'hist_stacked_stepfilled'])
def test_hist_stacked_stepfilled():
# make some data
Expand Down

0 comments on commit 56be9e1

Please sign in to comment.