Skip to content

Commit 379a2e3

Browse files
oscargusmeeseeksmachine
authored andcommitted
Backport PR #22594: FIX: do not pass dashes to collections in errorbar
1 parent 3b4f52e commit 379a2e3

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/matplotlib/axes/_axes.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3401,7 +3401,8 @@ def _upcast_err(err):
34013401
for key in ['marker', 'markersize', 'markerfacecolor',
34023402
'markeredgewidth', 'markeredgecolor', 'markevery',
34033403
'linestyle', 'fillstyle', 'drawstyle', 'dash_capstyle',
3404-
'dash_joinstyle', 'solid_capstyle', 'solid_joinstyle']:
3404+
'dash_joinstyle', 'solid_capstyle', 'solid_joinstyle',
3405+
'dashes']:
34053406
base_style.pop(key, None)
34063407

34073408
# Make the style dict for the line collections (the bars).

lib/matplotlib/tests/test_axes.py

+14
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,20 @@ def test_plot_format_kwarg_redundant():
665665
plt.errorbar([0], [0], fmt='none', color='blue')
666666

667667

668+
@check_figures_equal(extensions=["png"])
669+
def test_errorbar_dashes(fig_test, fig_ref):
670+
x = [1, 2, 3, 4]
671+
y = np.sin(x)
672+
673+
ax_ref = fig_ref.gca()
674+
ax_test = fig_test.gca()
675+
676+
line, *_ = ax_ref.errorbar(x, y, xerr=np.abs(y), yerr=np.abs(y))
677+
line.set_dashes([2, 2])
678+
679+
ax_test.errorbar(x, y, xerr=np.abs(y), yerr=np.abs(y), dashes=[2, 2])
680+
681+
668682
@image_comparison(['single_point', 'single_point'])
669683
def test_single_point():
670684
# Issue #1796: don't let lines.marker affect the grid

0 commit comments

Comments
 (0)