Skip to content

FIX: do not pass dashes to collections in errorbar #22594

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
Mar 4, 2022
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
3 changes: 2 additions & 1 deletion lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3411,7 +3411,8 @@ def _upcast_err(err):
for key in ['marker', 'markersize', 'markerfacecolor',
'markeredgewidth', 'markeredgecolor', 'markevery',
'linestyle', 'fillstyle', 'drawstyle', 'dash_capstyle',
'dash_joinstyle', 'solid_capstyle', 'solid_joinstyle']:
'dash_joinstyle', 'solid_capstyle', 'solid_joinstyle',
'dashes']:
base_style.pop(key, None)

# Make the style dict for the line collections (the bars).
Expand Down
14 changes: 14 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,20 @@ def test_plot_format_kwarg_redundant():
plt.errorbar([0], [0], fmt='none', color='blue')


@check_figures_equal(extensions=["png"])
def test_errorbar_dashes(fig_test, fig_ref):
x = [1, 2, 3, 4]
y = np.sin(x)

ax_ref = fig_ref.gca()
ax_test = fig_test.gca()

line, *_ = ax_ref.errorbar(x, y, xerr=np.abs(y), yerr=np.abs(y))
line.set_dashes([2, 2])

ax_test.errorbar(x, y, xerr=np.abs(y), yerr=np.abs(y), dashes=[2, 2])


@image_comparison(['single_point', 'single_point'])
def test_single_point():
# Issue #1796: don't let lines.marker affect the grid
Expand Down