Skip to content

Commit 9398d8a

Browse files
story645jovianw
andauthored
Added sanitize_sequence to kwargs in _preprocess_data (#26670)
Added a simple test for using errorbar with mapview kwarg Changed errorbar kwarg test to be more explicit Co-authored-by: jovianw <kvothejohn@gmail.com>
1 parent 6fc9624 commit 9398d8a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/matplotlib/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1462,7 +1462,10 @@ def func(foo, label=None): ...
14621462
@functools.wraps(func)
14631463
def inner(ax, *args, data=None, **kwargs):
14641464
if data is None:
1465-
return func(ax, *map(sanitize_sequence, args), **kwargs)
1465+
return func(
1466+
ax,
1467+
*map(sanitize_sequence, args),
1468+
**{k: sanitize_sequence(v) for k, v in kwargs.items()})
14661469

14671470
bound = new_sig.bind(ax, *args, **kwargs)
14681471
auto_label = (bound.arguments.get(label_namer)

lib/matplotlib/tests/test_axes.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,12 @@ def test_errorbar_dashes(fig_test, fig_ref):
835835
ax_test.errorbar(x, y, xerr=np.abs(y), yerr=np.abs(y), dashes=[2, 2])
836836

837837

838+
def test_errorbar_mapview_kwarg():
839+
D = {ii: ii for ii in range(10)}
840+
fig, ax = plt.subplots()
841+
ax.errorbar(x=D.keys(), y=D.values(), xerr=D.values())
842+
843+
838844
@image_comparison(['single_point', 'single_point'])
839845
def test_single_point():
840846
# Issue #1796: don't let lines.marker affect the grid

0 commit comments

Comments
 (0)