8000 Fix for axes.errorbars to enable use of line style and marker propert… · matplotlib/matplotlib@d967992 · GitHub
[go: up one dir, main page]

Skip to content

Commit d967992

Browse files
as691454jklymak
authored andcommitted
Fix for axes.errorbars to enable use of line style and marker properties from axes.prop_cycle
1 parent 0943a6c commit d967992

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2822,7 +2822,10 @@ def errorbar(self, x, y, yerr=None, xerr=None,
28222822
plot_line = (fmt.lower() != 'none')
28232823
label = kwargs.pop("label", None)
28242824

2825-
fmt_style_kwargs = {k: v for k, v in
2825+
if fmt == '':
2826+
fmt_style_kwargs = {}
2827+
else:
2828+
fmt_style_kwargs = {k: v for k, v in
28262829
zip(('linestyle', 'marker', 'color'),
28272830
_process_plot_format(fmt)) if v is not None}
28282831
if fmt == 'none':
@@ -2886,6 +2889,9 @@ def errorbar(self, x, y, yerr=None, xerr=None,
28862889
eb_cap_style = dict(base_style)
28872890
# eject any marker information from format string
28882891
eb_cap_style.pop('marker', None)
2892+
eb_lines_style.pop('markerfacecolor', None)
2893+
eb_lines_style.pop('markeredgewidth', None)
2894+
eb_lines_style.pop('markeredgecolor', None)
28892895
eb_cap_style.pop('ls', None)
28902896
eb_cap_style['linestyle'] = 'none'
28912897
if capsize is None:
Loading

lib/matplotlib/tests/test_axes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2815,6 +2815,16 @@ def test_errobar_nonefmt():
28152815
assert np.all(errbar.get_color() == mcolors.to_rgba('C0'))
28162816

28172817

2818+
@image_comparison(baseline_images=['errorbar_with_prop_cycle'],
2819+
extensions=['png'], style='mpl20', remove_text=True)
2820+
def test_errorbar_with_prop_cycle():
2821+
_cycle = cycler(ls=['--', ':'], marker=['s', 's'], mfc=['k', 'w'])
2822+
plt.rc("axes", prop_cycle=_cycle)
2823+
fig, ax = plt.subplots()
2824+
ax.errorbar(x=[2, 4, 10], y=[3, 2, 4], yerr=0.5)
2825+
ax.errorbar(x=[2, 4, 10], y=[6, 4, 2], yerr=0.5)
2826+
2827+
28182828
@image_comparison(baseline_images=['hist_stacked_stepfilled',
28192829
'hist_stacked_stepfilled'])
28202830
def test_hist_stacked_stepfilled():

0 commit comments

Comments
 (0)
0