8000 Merge pull request #17504 from timhoffm/bar-orientation2 · matplotlib/matplotlib@cf95c21 · GitHub
[go: up one dir, main page]

Skip to content

Commit cf95c21

Browse files
authored
Merge pull request #17504 from timhoffm/bar-orientation2
DOC: Undocument parameter orientation of bar()
2 parents 898bd5f + e85a17d commit cf95c21

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2351,10 +2351,6 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
23512351
log : bool, default: False
23522352
If *True*, set the y-axis to be log scale.
23532353
2354-
orientation : {'vertical', 'horizontal'}, optional
2355-
*This is for internal use only.* Please use `barh` for
2356-
horizontal bar plots. Default: 'vertical'.
2357-
23582354
**kwargs : `.Rectangle` properties
23592355
23602356
%(Rectangle)s
@@ -2393,6 +2389,9 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
23932389
error_kw.setdefault('ecolor', ecolor)
23942390
error_kw.setdefault('capsize', capsize)
23952391

2392+
# The keyword argument *orientation* is used by barh() to defer all
2393+
# logic and drawing to bar(). It is considered internal and is
2394+
# intentionally not mentioned in the docstring.
23962395
orientation = kwargs.pop('orientation', 'vertical')
23972396
cbook._check_in_list(['vertical', 'horizontal'],
23982397
orientation=orientation)

lib/matplotlib/tests/test_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5495,7 +5495,7 @@ def test_bar_broadcast_args():
54955495
# Check that a bar chart with a single height for all bars works.
54965496
ax.bar(range(4), 1)
54975497
# Check that a horizontal chart with one width works.
5498-
ax.bar(0, 1, bottom=range(4), width=1, orientation='horizontal')
5498+
ax.barh(0, 1, left=range(4), height=1)
54995499
# Check that edgecolor gets broadcast.
55005500
rect1, rect2 = ax.bar([0, 1], [0, 1], edgecolor=(.1, .2, .3, .4))
55015501
assert rect1.get_edgecolor() == rect2.get_edgecolor() == (.1, .2, .3, .4)

0 commit comments

Comments
 (0)
0