Skip to content

Api bar signature #9110

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 7 commits into from
Aug 31, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
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 #7954
closes #8327
closes #8527
closes #8882
  • Loading branch information
tacaswell committed Aug 28, 2017
commit e078f918c9625d29e1e65964315aa23602de5ecd
22 changes: 22 additions & 0 deletions doc/api/api_changes/2017-08-27-TAC.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Change to signatures of :meth:`~matplotlib.axes.Axes.bar` & :meth:`~matplotlib.axes.Axes.barh`
----------------------------------------------------------------------------------------------

For 2.0 the :ref:`default value of *align* <barbarh_align>` changed to
``'center'``. However this caused the signature of
:meth:`~matplotlib.axes.Axes.bar` and
:meth:`~matplotlib.axes.Axes.barh` to be misleading as the first parameters were
still *left* and *bottom* respectively::

bar(left, height, *, align='center', **kwargs)
barh(bottom, width, *, align='center', **kwargs)

despite behaving as the center in both cases. The methods now take ``*args, **kwargs``
is input and are documented to have the primary signatures of::

bar(x, height, *, align='center', **kwargs)
barh(y, width, *, align='center', **kwargs)

Passing *left* and *bottom* as keyword arguments to
:meth:`~matplotlib.axes.Axes.bar` and
:meth:`~matplotlib.axes.Axes.barh` respectively will warn.
Support will be removed in Matplotlib 3.0.
2 changes: 2 additions & 0 deletions doc/users/dflt_style_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,8 @@ The default value of the ``linecolor`` kwarg for `~matplotlib.Axes.hexbin` has
changed from ``'none'`` to ``'face'``. If 'none' is now supplied, no line edges
are drawn around the hexagons.

.. _barbarh_align:

``bar`` and ``barh``
--------------------

Expand Down
6 changes: 3 additions & 3 deletions examples/pie_and_polar_charts/nested_pie.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@
left_middle = np.arange(0.0, 2 * np.pi, 2 * np.pi / 12)
left_outer = np.arange(0.0, 2 * np.pi, 2 * np.pi / 9)

ax.bar(left=left_inner,
ax.bar(x=left_inner,
width=2 * np.pi / 6, bottom=0, color='C0',
linewidth=2, edgecolor='w',
height=np.zeros_like(left_inner) + 5)

ax.bar(left=left_middle,
ax.bar(x=left_middle,
width=2 * np.pi / 12, bottom=5, color='C1',
linewidth=2, edgecolor='w',
height=np.zeros_like(left_middle) + 2)

ax.bar(left=left_outer,
ax.bar(x=left_outer,
width=2 * np.pi / 9, bottom=7, color='C2',
linewidth=2, edgecolor='w',
height=np.zeros_like(left_outer) + 3)
Expand Down
Loading