Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6c69f3e

Browse filesBrowse files
authored
Merge pull request matplotlib#9110 from tacaswell/api_bar_signature
Api bar signature
2 parents a67b232 + 7e1a65d commit 6c69f3e
Copy full SHA for 6c69f3e

File tree

Expand file treeCollapse file tree

9 files changed

+265
-103
lines changed
Filter options
Expand file treeCollapse file tree

9 files changed

+265
-103
lines changed
+22Lines 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

Copy file name to clipboardExpand all lines: doc/users/dflt_style_changes.rst
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,8 @@ The default value of the ``linecolor`` kwarg for `~matplotlib.Axes.hexbin` has
601601
changed from ``'none'`` to ``'face'``. If 'none' is now supplied, no line edges
602602
are drawn around the hexagons.
603603

604+
.. _barbarh_align:
605+
604606
``bar`` and ``barh``
605607
--------------------
606608

‎examples/pie_and_polar_charts/nested_pie.py

Copy file name to clipboardExpand all lines: examples/pie_and_polar_charts/nested_pie.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@
4444
left_middle = np.arange(0.0, 2 * np.pi, 2 * np.pi / 12)
4545
left_outer = np.arange(0.0, 2 * np.pi, 2 * np.pi / 9)
4646

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

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

57-
ax.bar(left=left_outer,
57+
ax.bar(x=left_outer,
5858
width=2 * np.pi / 9, bottom=7, color='C2',
5959
linewidth=2, edgecolor='w',
6060
height=np.zeros_like(left_outer) + 3)

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,7 @@ def _replacer(data, key):
14631463

14641464

14651465
def _preprocess_data(replace_names=None, replace_all_args=False,
1466-
label_namer=None, positional_parameter_names=None):
1466+
label_namer=None, positional_parameter_names=None):
14671467
"""
14681468
A decorator to add a 'data' kwarg to any a function. The signature
14691469
of the input function must include the ax argument at the first position ::
@@ -1720,7 +1720,7 @@ def inner(ax, *args, **kwargs):
17201720
if len(replace_names) != 0:
17211721
_repl = "* All arguments with the following names: '{names}'."
17221722
if replace_all_args:
1723-
_repl += "\n* All positional arguments."
1723+
_repl += "\n * All positional arguments."
17241724
_repl = _repl.format(names="', '".join(sorted(replace_names)))
17251725
inner.__doc__ = (pre_doc +
17261726
_DATA_DOC_APPENDIX.format(replaced=_repl))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.