Skip to content

Commit a392168

Browse files
committed
Allow numpy arrays to be used as elinewidth
1 parent 5288e0c commit a392168

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
@@ -3374,7 +3374,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
33743374
# Make the style dict for the line collections (the bars).
33753375
eb_lines_style = {**base_style, 'color': ecolor}
33763376

3377-
if elinewidth:
3377+
if elinewidth is not None:
33783378
eb_lines_style['linewidth'] = elinewidth
33793379
elif 'linewidth' in kwargs:
33803380
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
@@ -3542,6 +3542,13 @@ def test_errorbar_every(fig_test, fig_ref):
35423542
capsize=4, c='C1', fmt='none')
35433543

35443544

3545+
@pytest.mark.parametrize('elinewidth', [[1, 2, 3],
3546+
np.array([1, 2, 3]),
3547+
1])
3548+
def test_errorbar_linewidth_type(elinewidth):
3549+
plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinewidth=elinewidth)
3550+
3551+
35453552
@image_comparison(['hist_stacked_stepfilled', 'hist_stacked_stepfilled'])
35463553
def test_hist_stacked_stepfilled():
35473554
# make some data

0 commit comments

Comments
 (0)