Skip to content

Undocument parameter orientation of bar() #17504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down