Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 65e767a

Browse files
committed
DOC: Fix ordering of Other Parameters wrt Returns.
The numpydoc sections listing is prescriptive, not descriptive, and the order should be followed.
1 parent 72add05 commit 65e767a

File tree

6 files changed

+109
-110
lines changed

6 files changed

+109
-110
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -377,14 +377,14 @@ def legend(self, *args, **kwargs):
377377
is shown in the legend and the automatic mechanism described above
378378
is not sufficient.
379379
380-
Other Parameters
381-
----------------
382-
%(_legend_kw_doc)s
383-
384380
Returns
385381
-------
386382
legend : `~matplotlib.legend.Legend`
387383
384+
Other Parameters
385+
----------------
386+
%(_legend_kw_doc)s
387+
388388
Notes
389389
-----
390390
Some artists are not supported by this function. See
@@ -1572,6 +1572,11 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):
15721572
You may suppress the warning by adding an empty format string
15731573
``plot('n', 'o', '', data=obj)``.
15741574
1575+
Returns
1576+
-------
1577+
lines
1578+
A list of `.Line2D` objects representing the plotted data.
1579+
15751580
Other Parameters
15761581
----------------
15771582
scalex, scaley : bool, default: True
@@ -1593,11 +1598,6 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):
15931598
15941599
%(_Line2D_docstr)s
15951600
1596-
Returns
1597-
-------
1598-
lines
1599-
A list of `.Line2D` objects representing the plotted data.
1600-
16011601
See Also
16021602
--------
16031603
scatter : XY scatter plot with markers of varying size and/or color (
@@ -2623,6 +2623,10 @@ def broken_barh(self, xranges, yrange, **kwargs):
26232623
yrange : (*ymin*, *yheight*)
26242624
The y-position and extend for all the rectangles.
26252625
2626+
Returns
2627+
-------
2628+
collection : `~.collections.BrokenBarHCollection`
2629+
26262630
Other Parameters
26272631
----------------
26282632
**kwargs : `.BrokenBarHCollection` properties
@@ -2641,10 +2645,6 @@ def broken_barh(self, xranges, yrange, **kwargs):
26412645
Supported keywords:
26422646
26432647
%(BrokenBarHCollection)s
2644-
2645-
Returns
2646-
-------
2647-
collection : `~.collections.BrokenBarHCollection`
26482648
"""
26492649
# process the unit information
26502650
if len(xranges):
@@ -3601,29 +3601,6 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
36013601
zorder : scalar, default: None
36023602
Sets the zorder of the boxplot.
36033603
3604-
Other Parameters
3605-
----------------
3606-
showcaps : bool, default: True
3607-
Show the caps on the ends of whiskers.
3608-
showbox : bool, default: True
3609-
Show the central box.
3610-
showfliers : bool, default: True
3611-
Show the outliers beyond the caps.
3612-
showmeans : bool, default: False
3613-
Show the arithmetic means.
3614-
capprops : dict, default: None
3615-
The style of the caps.
3616-
boxprops : dict, default: None
3617-
The style of the box.
3618-
whiskerprops : dict, default: None
3619-
The style of the whiskers.
3620-
flierprops : dict, default: None
3621-
The style of the fliers.
3622-
medianprops : dict, default: None
3623-
The style of the median.
3624-
meanprops : dict, default: None
3625-
The style of the mean.
3626-
36273604
Returns
36283605
-------
36293606
result : dict
@@ -3648,6 +3625,29 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
36483625
36493626
- ``means``: points or lines representing the means.
36503627
3628+
Other Parameters
3629+
----------------
3630+
showcaps : bool, default: True
3631+
Show the caps on the ends of whiskers.
3632+
showbox : bool, default: True
3633+
Show the central box.
3634+
showfliers : bool, default: True
3635+
Show the outliers beyond the caps.
3636+
showmeans : bool, default: False
3637+
Show the arithmetic means.
3638+
capprops : dict, default: None
3639+
The style of the caps.
3640+
boxprops : dict, default: None
3641+
The style of the box.
3642+
whiskerprops : dict, default: None
3643+
The style of the whiskers.
3644+
flierprops : dict, default: None
3645+
The style of the fliers.
3646+
medianprops : dict, default: None
3647+
The style of the median.
3648+
meanprops : dict, default: None
3649+
The style of the mean.
3650+
36513651
"""
36523652

36533653
# Missing arguments default to rcParams.
@@ -4550,6 +4550,20 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
45504550
45514551
Order of scalars is (left, right, bottom, top).
45524552
4553+
Returns
4554+
-------
4555+
polycollection : `~matplotlib.collections.PolyCollection`
4556+
A `.PolyCollection` defining the hexagonal bins.
4557+
4558+
- `.PolyCollection.get_offset` contains a Mx2 array containing
4559+
the x, y positions of the M hexagon centers.
4560+
- `.PolyCollection.get_array` contains the values of the M
4561+
hexagons.
4562+
4563+
If *marginals* is *True*, horizontal
4564+
bar and vertical bar (both PolyCollections) will be attached
4565+
to the return collection as attributes *hbar* and *vbar*.
4566+
45534567
Other Parameters
45544568
----------------
45554569
cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
@@ -4600,20 +4614,6 @@ def reduce_C_function(C: array) -> float
46004614
46014615
%(PolyCollection)s
46024616
4603-
Returns
4604-
-------
4605-
polycollection : `~matplotlib.collections.PolyCollection`
4606-
A `.PolyCollection` defining the hexagonal bins.
4607-
4608-
- `.PolyCollection.get_offset` contains a Mx2 array containing
4609-
the x, y positions of the M hexagon centers.
4610-
- `.PolyCollection.get_array` contains the values of the M
4611-
hexagons.
4612-
4613-
If *marginals* is *True*, horizontal
4614-
bar and vertical bar (both PolyCollections) will be attached
4615-
to the return collection as attributes *hbar* and *vbar*.
4616-
46174617
"""
46184618
self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)
46194619

@@ -5119,6 +5119,11 @@ def _fill_between_x_or_y(
51195119
value ``y[i]``.
51205120
- 'mid': Steps occur half-way between the *x* positions.
51215121
5122+
Returns
5123+
-------
5124+
`.PolyCollection`
5125+
A `.PolyCollection` containing the plotted polygons.
5126+
51225127
Other Parameters
51235128
----------------
51245129
**kwargs
@@ -5127,11 +5132,6 @@ def _fill_between_x_or_y(
51275132
51285133
%(PolyCollection)s
51295134
5130-
Returns
5131-
-------
5132-
`.PolyCollection`
5133-
A `.PolyCollection` containing the plotted polygons.
5134-
51355135
See Also
51365136
--------
51375137
fill_between : Fill between two sets of y-values.

lib/matplotlib/axes/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3465,7 +3465,7 @@ def set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs):
34653465
The labels.
34663466
34673467
Other Parameters
3468-
-----------------
3468+
----------------
34693469
**kwargs : `~.text.Text` properties.
34703470
"""
34713471
if fontdict is not None:

lib/matplotlib/axes/_secondary_axes.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,14 +374,13 @@ def set_color(self, color):
374374
See :doc:`/gallery/subplots_axes_and_figures/secondary_axis`
375375
for examples of making these conversions.
376376
377+
Returns
378+
-------
379+
ax : axes._secondary_axes.SecondaryAxis
377380
378381
Other Parameters
379382
----------------
380383
**kwargs : `~matplotlib.axes.Axes` properties.
381384
Other miscellaneous axes parameters.
382-
383-
Returns
384-
-------
385-
ax : axes._secondary_axes.SecondaryAxis
386385
'''
387386
docstring.interpd.update(_secax_docstring=_secax_docstring)

lib/matplotlib/figure.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,14 @@ def add_axes(self, *args, **kwargs):
11421142
label : str
11431143
A label for the returned axes.
11441144
1145+
Returns
1146+
-------
1147+
axes : `~.axes.Axes` (or a subclass of `~.axes.Axes`)
1148+
The returned axes class depends on the projection used. It is
1149+
`~.axes.Axes` if rectilinear projection are used and
1150+
`.projections.polar.PolarAxes` if polar projection
1151+
are used.
1152+
11451153
Other Parameters
11461154
----------------
11471155
**kwargs
@@ -1154,14 +1162,6 @@ def add_axes(self, *args, **kwargs):
11541162
11551163
%(Axes)s
11561164
1157-
Returns
1158-
-------
1159-
axes : `~.axes.Axes` (or a subclass of `~.axes.Axes`)
1160-
The returned axes class depends on the projection used. It is
1161-
`~.axes.Axes` if rectilinear projection are used and
1162-
`.projections.polar.PolarAxes` if polar projection
1163-
are used.
1164-
11651165
Notes
11661166
-----
11671167
If the figure already has an axes with key (*args*,
@@ -1290,6 +1290,16 @@ def add_subplot(self, *args, **kwargs):
12901290
label : str
12911291
A label for the returned axes.
12921292
1293+
Returns
1294+
-------
1295+
axes : `.axes.SubplotBase`, or another subclass of `~.axes.Axes`
1296+
1297+
The axes of the subplot. The returned axes base class depends on
1298+
the projection used. It is `~.axes.Axes` if rectilinear projection
1299+
are used and `.projections.polar.PolarAxes` if polar projection
1300+
are used. The returned axes is then a subplot subclass of the
1301+
base class.
1302+
12931303
Other Parameters
12941304
----------------
12951305
**kwargs
@@ -1301,16 +1311,6 @@ def add_subplot(self, *args, **kwargs):
13011311
13021312
%(Axes)s
13031313
1304-
Returns
1305-
-------
1306-
axes : `.axes.SubplotBase`, or another subclass of `~.axes.Axes`
1307-
1308-
The axes of the subplot. The returned axes base class depends on
1309-
the projection used. It is `~.axes.Axes` if rectilinear projection
1310-
are used and `.projections.polar.PolarAxes` if polar projection
1311-
are used. The returned axes is then a subplot subclass of the
1312-
base class.
1313-
13141314
Notes
13151315
-----
13161316
If the figure already has a subplot with key (*args*,
@@ -1788,14 +1788,14 @@ def legend(self, *args, **kwargs):
17881788
is shown in the legend and the automatic mechanism described above
17891789
is not sufficient.
17901790
1791-
Other Parameters
1792-
----------------
1793-
%(_legend_kw_doc)s
1794-
17951791
Returns
17961792
-------
17971793
`~matplotlib.legend.Legend`
17981794
1795+
Other Parameters
1796+
----------------
1797+
%(_legend_kw_doc)s
1798+
17991799
Notes
18001800
-----
18011801
Some artists are not supported by this function. See
@@ -1843,17 +1843,17 @@ def text(self, x, y, s, fontdict=None, **kwargs):
18431843
the defaults are determined by :rc:`font.*`. Properties passed as
18441844
*kwargs* override the corresponding ones given in *fontdict*.
18451845
1846+
Returns
1847+
-------
1848+
text : `~.text.Text`
1849+
18461850
Other Parameters
18471851
----------------
18481852
**kwargs : `~matplotlib.text.Text` properties
18491853
Other miscellaneous text parameters.
18501854
18511855
%(Text)s
18521856
1853-
Returns
1854-
-------
1855-
text : `~.text.Text`
1856-
18571857
See Also
18581858
--------
18591859
.Axes.text

lib/matplotlib/pyplot.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,14 @@ def axes(arg=None, **kwargs):
789789
label : str
790790
A label for the returned axes.
791791
792+
Returns
793+
-------
794+
axes : `~.axes.Axes` (or a subclass of `~.axes.Axes`)
795+
The returned axes class depends on the projection used. It is
796+
`~.axes.Axes` if rectilinear projection are used and
797+
`.projections.polar.PolarAxes` if polar projection
798+
are used.
799+
792800
Other Parameters
793801
----------------
794802
**kwargs
@@ -801,14 +809,6 @@ def axes(arg=None, **kwargs):
801809
802810
%(Axes)s
803811
804-
Returns
805-
-------
806-
axes : `~.axes.Axes` (or a subclass of `~.axes.Axes`)
807-
The returned axes class depends on the projection used. It is
808-
`~.axes.Axes` if rectilinear projection are used and
809-
`.projections.polar.PolarAxes` if polar projection
810-
are used.
811-
812812
Notes
813813
-----
814814
If the figure already has a axes with key (*args*,
@@ -914,17 +914,6 @@ def subplot(*args, **kwargs):
914914
label : str
915915
A label for the returned axes.
916916
917-
Other Parameters
918-
----------------
919-
**kwargs
920-
This method also takes the keyword arguments for the returned axes
921-
base class; except for the *figure* argument. The keyword arguments
922-
for the rectilinear base class `~.axes.Axes` can be found in
923-
the following table but there might also be other keyword
924-
arguments if another projection is used.
925-
926-
%(Axes)s
927-
928917
Returns
929918
-------
930919
axes : an `.axes.SubplotBase` subclass of `~.axes.Axes` (or a subclass \
@@ -936,6 +925,17 @@ def subplot(*args, **kwargs):
936925
are used. The returned axes is then a subplot subclass of the
937926
base class.
938927
928+
Other Parameters
929+
----------------
930+
**kwargs
931+
This method also takes the keyword arguments for the returned axes
932+
base class; except for the *figure* argument. The keyword arguments
933+
for the rectilinear base class `~.axes.Axes` can be found in
934+
the following table but there might also be other keyword
935+
arguments if another projection is used.
936+
937+
%(Axes)s
938+
939939
Notes
940940
-----
941941
Creating a subplot will delete any pre-existing subplot that overlaps

0 commit comments

Comments
 (0)