Skip to content

Commit 99a681e

Browse files
authored
Merge pull request #21169 from meeseeksmachine/auto-backport-of-pr-21126-on-v3.5.x
Backport PR #21126 on branch v3.5.x (Deprecate passing formatting parameters positionally to stem())
2 parents f090ba6 + 85496e7 commit 99a681e

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Passing formatting parameters positionally to ``stem()`` is deprecated
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

lib/matplotlib/axes/_axes.py

+6
Original file line numberDiff line numberDiff line change
@@ -2849,6 +2849,12 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
28492849
args = ()
28502850
else:
28512851
locs, heads, *args = args
2852+
if args:
2853+
_api.warn_deprecated(
2854+
"3.5",
2855+
message="Passing the linefmt parameter positionally is "
2856+
"deprecated since Matplotlib %(since)s; the "
2857+
"parameter will become keyword-only %(removal)s.")
28522858

28532859
if orientation == 'vertical':
28542860
locs, heads = self._process_unit_info([("x", locs), ("y", heads)])

lib/matplotlib/tests/test_axes.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3642,16 +3642,16 @@ def test_stem_args():
36423642
# Test the call signatures
36433643
ax.stem(y)
36443644
ax.stem(x, y)
3645-
ax.stem(x, y, 'r--')
3646-
ax.stem(x, y, 'r--', basefmt='b--')
3645+
ax.stem(x, y, linefmt='r--')
3646+
ax.stem(x, y, linefmt='r--', basefmt='b--')
36473647

36483648

36493649
def test_stem_dates():
36503650
fig, ax = plt.subplots(1, 1)
36513651
xs = [dateutil.parser.parse("2013-9-28 11:00:00"),
36523652
dateutil.parser.parse("2013-9-28 12:00:00")]
36533653
ys = [100, 200]
3654-
ax.stem(xs, ys, "*-")
3654+
ax.stem(xs, ys)
36553655

36563656

36573657
@pytest.mark.parametrize("use_line_collection", [True, False],

0 commit comments

Comments
 (0)