From e85a17d8c3524b61416440c520df49d3db695a49 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Mon, 25 May 2020 00:51:42 +0200 Subject: [PATCH] Undocument parameter orientation of bar() --- lib/matplotlib/axes/_axes.py | 7 +++---- lib/matplotlib/tests/test_axes.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index e41cfba674e7..cc36b6871778 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2351,10 +2351,6 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center", log : bool, default: False If *True*, set the y-axis to be log scale. - orientation : {'vertical', 'horizontal'}, optional - *This is for internal use only.* Please use `barh` for - horizontal bar plots. Default: 'vertical'. - **kwargs : `.Rectangle` properties %(Rectangle)s @@ -2393,6 +2389,9 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center", error_kw.setdefault('ecolor', ecolor) error_kw.setdefault('capsize', capsize) + # The keyword argument *orientation* is used by barh() to defer all + # logic and drawing to bar(). It is considered internal and is + # intentionally not mentioned in the docstring. orientation = kwargs.pop('orientation', 'vertical') cbook._check_in_list(['vertical', 'horizontal'], orientation=orientation) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index dfb2450836f2..b8930ccdfba0 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -5495,7 +5495,7 @@ def test_bar_broadcast_args(): # Check that a bar chart with a single height for all bars works. ax.bar(range(4), 1) # Check that a horizontal chart with one width works. - ax.bar(0, 1, bottom=range(4), width=1, orientation='horizontal') + ax.barh(0, 1, left=range(4), height=1) # Check that edgecolor gets broadcast. rect1, rect2 = ax.bar([0, 1], [0, 1], edgecolor=(.1, .2, .3, .4)) assert rect1.get_edgecolor() == rect2.get_edgecolor() == (.1, .2, .3, .4)