Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5a80b8e

Browse files
authored
Merge pull request #19950 from meeseeksmachine/auto-backport-of-pr-19948-on-v3.4.x
Backport PR #19948 on branch v3.4.x (Allow numpy arrays to be used as elinewidth)
2 parents da4c869 + 8b18c29 commit 5a80b8e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3382,7 +3382,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
33823382
# Make the style dict for the line collections (the bars).
33833383
eb_lines_style = {**base_style, 'color': ecolor}
33843384

3385-
if elinewidth:
3385+
if elinewidth is not None:
33863386
eb_lines_style['linewidth'] = elinewidth
33873387
elif 'linewidth' in kwargs:
33883388
eb_lines_style['linewidth'] = kwargs['linewidth']

lib/matplotlib/tests/test_axes.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3519,6 +3519,13 @@ def test_errorbar_every(fig_test, fig_ref):
35193519
capsize=4, c='C1', fmt='none')
35203520

35213521

3522+
@pytest.mark.parametrize('elinewidth', [[1, 2, 3],
3523+
np.array([1, 2, 3]),
3524+
1])
3525+
def test_errorbar_linewidth_type(elinewidth):
3526+
plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinewidth=elinewidth)
3527+
3528+
35223529
@image_comparison(['hist_stacked_stepfilled', 'hist_stacked_stepfilled'])
35233530
def test_hist_stacked_stepfilled():
35243531
# make some data

0 commit comments

Comments
 (0)