Skip to content

Commit 5072694

Browse files
committed
Docstring cleanups around DATA_PARAMETER_PLACEHOLDER.
- `[notes section required to get data note injection right]` has been obsoleted by DATA_PARAMETER_PLACEHOLDER; get rid of them. - loglog, semilogx, semilogy are thin wrappers around plot; it seems fine to not document data there and leave it implicitly part of `**kwargs: all parameters supported by plot`. Then "Other Parameters" only contains `**kwargs` whose description is quite short, so it can just be lifted into the main Parameters section rather than requiring a separate section just for itself. - Likewise for `step`, but that method actually explicitly lists `data` in its signature, so just move its (already existing) description down to its correct position. This change was motivated by the fact that DATA_PARAMETER_PLACEHOLDER is not correctly handled for these simple plot() wrappers; because they all operate without going through _preprocess_data(), fixing them would also require their own ad-hoc solution anyways.
1 parent c757fe1 commit 5072694

File tree

1 file changed

+15
-47
lines changed

1 file changed

+15
-47
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 15 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,18 +1745,13 @@ def loglog(self, *args, **kwargs):
17451745
Non-positive values can be masked as invalid, or clipped to a very
17461746
small positive number.
17471747
1748+
**kwargs
1749+
All parameters supported by `.plot`.
1750+
17481751
Returns
17491752
-------
17501753
list of `.Line2D`
17511754
Objects representing the plotted data.
1752-
1753-
Other Parameters
1754-
----------------
1755-
data : indexable object, optional
1756-
DATA_PARAMETER_PLACEHOLDER
1757-
1758-
**kwargs
1759-
All parameters supported by `.plot`.
17601755
"""
17611756
dx = {k: v for k, v in kwargs.items()
17621757
if k in ['base', 'subs', 'nonpositive',
@@ -1801,18 +1796,13 @@ def semilogx(self, *args, **kwargs):
18011796
Non-positive values in x can be masked as invalid, or clipped to a
18021797
very small positive number.
18031798
1799+
**kwargs
1800+
All parameters supported by `.plot`.
1801+
18041802
Returns
18051803
-------
18061804
list of `.Line2D`
18071805
Objects representing the plotted data.
1808-
1809-
Other Parameters
1810-
----------------
1811-
data : indexable object, optional
1812-
DATA_PARAMETER_PLACEHOLDER
1813-
1814-
**kwargs
1815-
All parameters supported by `.plot`.
18161806
"""
18171807
d = {k: v for k, v in kwargs.items()
18181808
if k in ['base', 'subs', 'nonpositive',
@@ -1853,18 +1843,13 @@ def semilogy(self, *args, **kwargs):
18531843
Non-positive values in y can be masked as invalid, or clipped to a
18541844
very small positive number.
18551845
1846+
**kwargs
1847+
All parameters supported by `.plot`.
1848+
18561849
Returns
18571850
-------
18581851
list of `.Line2D`
18591852
Objects representing the plotted data.
1860-
1861-
Other Parameters
1862-
----------------
1863-
data : indexable object, optional
1864-
DATA_PARAMETER_PLACEHOLDER
1865-
1866-
**kwargs
1867-
All parameters supported by `.plot`.
18681853
"""
18691854
d = {k: v for k, v in kwargs.items()
18701855
if k in ['base', 'subs', 'nonpositive',
@@ -2098,10 +2083,6 @@ def step(self, x, y, *args, where='pre', data=None, **kwargs):
20982083
and plotted on the given positions, however, this is a rarely
20992084
needed feature for step plots.
21002085
2101-
data : indexable object, optional
2102-
An object with labelled data. If given, provide the label names to
2103-
plot in *x* and *y*.
2104-
21052086
where : {'pre', 'post', 'mid'}, default: 'pre'
21062087
Define where the steps should be placed:
21072088
@@ -2113,22 +2094,17 @@ def step(self, x, y, *args, where='pre', data=None, **kwargs):
21132094
value ``y[i]``.
21142095
- 'mid': Steps occur half-way between the *x* positions.
21152096
2116-
Returns
2117-
-------
2118-
list of `.Line2D`
2119-
Objects representing the plotted data.
2120-
2121-
Other Parameters
2122-
----------------
21232097
data : indexable object, optional
2124-
DATA_PARAMETER_PLACEHOLDER
2098+
An object with labelled data. If given, provide the label names to
2099+
plot in *x* and *y*.
21252100
21262101
**kwargs
21272102
Additional parameters are the same as those for `.plot`.
21282103
2129-
Notes
2130-
-----
2131-
.. [notes section required to get data note injection right]
2104+
Returns
2105+
-------
2106+
list of `.Line2D`
2107+
Objects representing the plotted data.
21322108
"""
21332109
_api.check_in_list(('pre', 'post', 'mid'), where=where)
21342110
kwargs['drawstyle'] = 'steps-' + where
@@ -5148,10 +5124,6 @@ def _fill_between_x_or_y(
51485124
--------
51495125
fill_between : Fill between two sets of y-values.
51505126
fill_betweenx : Fill between two sets of x-values.
5151-
5152-
Notes
5153-
-----
5154-
.. [notes section required to get data note injection right]
51555127
"""
51565128

51575129
dep_dir = {"x": "y", "y": "x"}[ind_dir]
@@ -6227,10 +6199,6 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
62276199
**kwargs
62286200
Supported additional parameters depend on the type of grid.
62296201
See return types of *image* for further description.
6230-
6231-
Notes
6232-
-----
6233-
.. [notes section required to get data note injection right]
62346202
"""
62356203

62366204
C = args[-1]

0 commit comments

Comments
 (0)