Skip to content

Errorbars accept marker_options and follow prop_cycle #9952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2822,7 +2822,10 @@ def errorbar(self, x, y, yerr=None, xerr=None,
plot_line = (fmt.lower() != 'none')
label = kwargs.pop("label", None)

fmt_style_kwargs = {k: v for k, v in
if fmt == '':
fmt_style_kwargs = {}
else:
fmt_style_kwargs = {k: v for k, v in
zip(('linestyle', 'marker', 'color'),
_process_plot_format(fmt)) if v is not None}
if fmt == 'none':
Expand Down Expand Up @@ -2886,6 +2889,9 @@ def errorbar(self, x, y, yerr=None, xerr=None,
eb_cap_style = dict(base_style)
# eject any marker information from format string
eb_cap_style.pop('marker', None)
eb_lines_style.pop('markerfacecolor', None)
eb_lines_style.pop('markeredgewidth', None)
eb_lines_style.pop('markeredgecolor', None)
eb_cap_style.pop('ls', None)
eb_cap_style['linestyle'] = 'none'
if capsize is None:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2815,6 +2815,16 @@ def test_errobar_nonefmt():
assert np.all(errbar.get_color() == mcolors.to_rgba('C0'))


@image_comparison(baseline_images=['errorbar_with_prop_cycle'],
extensions=['png'], style='mpl20', remove_text=True)
def test_errorbar_with_prop_cycle():
_cycle = cycler(ls=['--', ':'], marker=['s', 's'], mfc=['k', 'w'])
plt.rc("axes", prop_cycle=_cycle)
fig, ax = plt.subplots()
ax.errorbar(x=[2, 4, 10], y=[3, 2, 4], yerr=0.5)
ax.errorbar(x=[2, 4, 10], y=[6, 4, 2], yerr=0.5)


@image_comparison(baseline_images=['hist_stacked_stepfilled',
'hist_stacked_stepfilled'])
def test_hist_stacked_stepfilled():
Expand Down