Skip to content

Commit

Permalink
Merge pull request matplotlib#8037 from tacaswell/fix_errorbar_color_…
Browse files Browse the repository at this point in the history
…cycle

[MRG+1] FIX: in errorbar discard any kwargs which have None value
  • Loading branch information
dopplershift authored Feb 8, 2017
2 parents 013fd3f + c43f4fd commit dfd1da5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2798,6 +2798,9 @@ def errorbar(self, x, y, yerr=None, xerr=None,
.. plot:: mpl_examples/statistics/errorbar_demo.py
"""
kwargs = cbook.normalize_kwargs(kwargs, _alias_map)
# anything that comes in as 'None', drop so the default thing
# happens down stream
kwargs = {k: v for k, v in kwargs.items() if v is not None}
kwargs.setdefault('zorder', 2)

if errorevery < 1:
Expand Down
16 changes: 16 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2365,6 +2365,22 @@ def test_errorbar():
ax.set_title("Simplest errorbars, 0.2 in x, 0.4 in y")


@cleanup
def test_errorbar_colorcycle():

f, ax = plt.subplots()
x = np.arange(10)
y = 2*x

e1, _, _ = ax.errorbar(x, y, c=None)
e2, _, _ = ax.errorbar(x, 2*y, c=None)
ln1, = ax.plot(x, 4*y)

assert mcolors.to_rgba(e1.get_color()) == mcolors.to_rgba('C0')
assert mcolors.to_rgba(e2.get_color()) == mcolors.to_rgba('C1')
assert mcolors.to_rgba(ln1.get_color()) == mcolors.to_rgba('C2')


@cleanup
def test_errorbar_shape():
fig = plt.figure()
Expand Down

0 comments on commit dfd1da5

Please sign in to comment.