From 870b38adf090e8ced8f7d51e33c69f922bbb7bb7 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 21 Dec 2022 23:19:32 -0600 Subject: [PATCH 1/2] Axes.stem docstring document orientation as literals We use `_api.check_in_list` in the method body, so arbitrary strings are not accetable and will raise if it is not precisely "vertical" or "horizontal". This brings the docstring in line with this behavior. Many other places which have an orientation kwarg are similarly documented. --- lib/matplotlib/axes/_axes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 06f88a470c1f..cee69b494673 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2946,9 +2946,9 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0, basefmt : str, default: 'C3-' ('C2-' in classic mode) A format string defining the properties of the baseline. - orientation : str, default: 'vertical' + orientation : {'vertical', 'horizontal'}, default: 'vertical' If 'vertical', will produce a plot with stems oriented vertically, - otherwise the stems will be oriented horizontally. + If 'horizontal' the stems will be oriented horizontally. bottom : float, default: 0 The y/x-position of the baseline (depending on orientation). From f14d9bb7e62f667e9070f8ee896f21ffc2bcd516 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Thu, 22 Dec 2022 08:47:51 +0100 Subject: [PATCH 2/2] Update lib/matplotlib/axes/_axes.py Co-authored-by: Elliott Sales de Andrade --- lib/matplotlib/axes/_axes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index cee69b494673..32f21385b911 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2948,7 +2948,7 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0, orientation : {'vertical', 'horizontal'}, default: 'vertical' If 'vertical', will produce a plot with stems oriented vertically, - If 'horizontal' the stems will be oriented horizontally. + If 'horizontal', the stems will be oriented horizontally. bottom : float, default: 0 The y/x-position of the baseline (depending on orientation).