diff --git a/doc/api/next_api_changes/deprecations/21126-TH.rst b/doc/api/next_api_changes/deprecations/21126-TH.rst new file mode 100644 index 000000000000..43df16287319 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/21126-TH.rst @@ -0,0 +1,2 @@ +Passing formatting parameters positionally to ``stem()`` is deprecated +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 3856e45229fc..e8614e07ebed 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2849,6 +2849,12 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0, args = () else: locs, heads, *args = args + if args: + _api.warn_deprecated( + "3.5", + message="Passing the linefmt parameter positionally is " + "deprecated since Matplotlib %(since)s; the " + "parameter will become keyword-only %(removal)s.") if orientation == 'vertical': locs, heads = self._process_unit_info([("x", locs), ("y", heads)]) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index e96f9d5605d6..b1d6dae02d4f 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -3641,8 +3641,8 @@ def test_stem_args(): # Test the call signatures ax.stem(y) ax.stem(x, y) - ax.stem(x, y, 'r--') - ax.stem(x, y, 'r--', basefmt='b--') + ax.stem(x, y, linefmt='r--') + ax.stem(x, y, linefmt='r--', basefmt='b--') def test_stem_dates(): @@ -3650,7 +3650,7 @@ def test_stem_dates(): xs = [dateutil.parser.parse("2013-9-28 11:00:00"), dateutil.parser.parse("2013-9-28 12:00:00")] ys = [100, 200] - ax.stem(xs, ys, "*-") + ax.stem(xs, ys) @pytest.mark.parametrize("use_line_collection", [True, False],
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: