Skip to content

Commit 674dce4

Browse files
committed
API: change signature of bar and barh
Change the documented first position argument to x and y for bar and barh respectively but still support passing in left and bottom as keyword arguments. closes matplotlib#7954 closes matplotlib#8327 closes matplotlib#8527 closes matplotlib#8882
1 parent 7cf904d commit 674dce4

4 files changed

Lines changed: 220 additions & 72 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Change to signatures of :meth:`~matplotlib.axes.Axes.bar` & :meth:`~matplotlib.axes.Axes.barh`
2+
----------------------------------------------------------------------------------------------
3+
4+
For 2.0 the :ref:`default value of *align* <barbarh_align>` changed to
5+
``'center'``. However this caused the signature of
6+
:meth:`~matplotlib.axes.Axes.bar` and
7+
:meth:`~matplotlib.axes.Axes.barh` to be misleading as the first parameters were
8+
still *left* and *bottom* respectively::
9+
10+
bar(left, height, *, align='center', **kwargs)
11+
barh(bottom, width, *, align='center', **kwargs)
12+
13+
despite behaving as the center in both cases. The methods now take ``*args, **kwargs``
14+
is input and are documented to have the primary signatures of ::
15+
16+
bar(x, height, *, align='center', **kwargs)
17+
barh(y, width, *, align='center', **kwargs)
18+
19+
Passing *left* and *bottom* as keyword arguments to
20+
:meth:`~matplotlib.axes.Axes.bar` and
21+
:meth:`~matplotlib.axes.Axes.barh` respectively will warn.
22+
Support will be removed in Matplotlib 3.0.

‎doc/users/dflt_style_changes.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,8 @@ The default value of the ``linecolor`` kwarg for `~matplotlib.Axes.hexbin` has
599599
changed from ``'none'`` to ``'face'``. If 'none' is now supplied, no line edges
600600
are drawn around the hexagons.
601601

602+
.. _barbarh_align:
603+
602604
``bar`` and ``barh``
603605
--------------------
604606

0 commit comments

Comments
 (0)