8000 FIX: do not pass dashes to collections in errorbar · matplotlib/matplotlib@4ebff47 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4ebff47

Browse files
committed
FIX: do not pass dashes to collections in errorbar
*dashes* is another Line2D only kwarg that should not be passed to all of the artists created. closes #22590
1 parent 4a3c5d6 commit 4ebff47

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3411,7 +3411,8 @@ def _upcast_err(err):
34113411
for key in ['marker', 'markersize', 'markerfacecolor',
34123412
'markeredgewidth', 'markeredgecolor', 'markevery',
34133413
'linestyle', 'fillstyle', 'drawstyle', 'dash_capstyle',
3414-
'dash_joinstyle', 'solid_capstyle', 'solid_joinstyle']:
3414+
'dash_joinstyle', 'solid_capstyle', 'solid_joinstyle',
3415+
'dashes']:
34153416
base_style.pop(key, None)
34163417

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

lib/matplotlib/tests/test_axes.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,20 @@ def test_plot_format_kwarg_redundant():
679679
plt.errorbar([0], [0], fmt='none', color='blue')
680680

681681

682+
@check_figures_equal(extensions=["png"])
683+
def test_errorbar_dashes(fig_test, fig_ref):
684+
x = [1, 2, 3, 4]
685+
y = np.sin(x)
686+
687+
ax_ref = fig_ref.gca()
688+
ax_test = fig_test.gca()
689+
690+
line, *_ = ax_ref.errorbar(x, y, xerr=np.abs(y), yerr=np.abs(y))
691+
line.set_dashes([2, 2])
692+
693+
ax_test.errorbar(x, y, xerr=np.abs(y), yerr=np.abs(y), dashes=[2, 2])
694+
695+
682696
@image_comparison(['single_point', 'single_point'])
683697
def test_single_point():
684698
# Issue #1796: don't let lines.marker affect the grid

0 commit comments

Comments
 (0)
0