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

Skip to content

Commit e11582f

Browse files
authored
More cleanup defaults in docstrings (#15822)
More cleanup defaults in docstrings
2 parents e240493 + 351b10d commit e11582f

23 files changed

+118
-127
lines changed

lib/matplotlib/_cm.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,16 @@ def cubehelix(gamma=1.0, s=0.5, r=-1.5, h=1.0):
8686
8787
Parameters
8888
----------
89-
gamma : float, optional, default: 1
89+
gamma : float, default: 1
9090
Gamma factor emphasizing either low intensity values (gamma < 1), or
9191
high intensity values (gamma > 1).
92-
s : float, optional, default: 0.5 (purple)
92+
s : float, default: 0.5 (purple)
9393
The starting color.
94-
r : float, optional, default: -1.5
94+
r : float, default: -1.5
9595
The number of r, g, b rotations in color that are made from the start
9696
to the end of the color scheme. The default of -1.5 corresponds to ->
9797
B -> G -> R -> B.
98-
h : float, optional, default: 1
98+
h : float, default: 1
9999
The hue, i.e. how saturated the colors are. If this parameter is zero
100100
then the color scheme is purely a greyscale.
101101
"""

lib/matplotlib/axes/_axes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,7 @@ def loglog(self, *args, **kwargs):
17711771
17721772
Parameters
17731773
----------
1774-
basex, basey : scalar, optional, default 10
1774+
basex, basey : float, default: 10
17751775
Base of the x/y logarithm.
17761776
17771777
subsx, subsy : sequence, optional
@@ -1780,7 +1780,7 @@ def loglog(self, *args, **kwargs):
17801780
decades in the plot.
17811781
See `.Axes.set_xscale` / `.Axes.set_yscale` for details.
17821782
1783-
nonposx, nonposy : {'mask', 'clip'}, optional, default 'mask'
1783+
nonposx, nonposy : {'mask', 'clip'}, default: 'mask'
17841784
Non-positive values in x or y can be masked as invalid, or clipped
17851785
to a very small positive number.
17861786
@@ -1825,15 +1825,15 @@ def semilogx(self, *args, **kwargs):
18251825
18261826
Parameters
18271827
----------
1828-
basex : scalar, optional, default 10
1828+
basex : float, default: 10
18291829
Base of the x logarithm.
18301830
18311831
subsx : array-like, optional
18321832
The location of the minor xticks. If *None*, reasonable locations
18331833
are automatically chosen depending on the number of decades in the
18341834
plot. See `.Axes.set_xscale` for details.
18351835
1836-
nonposx : {'mask', 'clip'}, optional, default 'mask'
1836+
nonposx : {'mask', 'clip'}, default: 'mask'
18371837
Non-positive values in x can be masked as invalid, or clipped to a
18381838
very small positive number.
18391839
@@ -1874,15 +1874,15 @@ def semilogy(self, *args, **kwargs):
18741874
18751875
Parameters
18761876
----------
1877-
basey : scalar, optional, default 10
1877+
basey : float, default: 10
18781878
Base of the y logarithm.
18791879
18801880
subsy : array-like, optional
18811881
The location of the minor yticks. If *None*, reasonable locations
18821882
are automatically chosen depending on the number of decades in the
18831883
plot. See `.Axes.set_yscale` for details.
18841884
1885-
nonposy : {'mask', 'clip'}, optional, default 'mask'
1885+
nonposy : {'mask', 'clip'}, default: 'mask'
18861886
Non-positive values in y can be masked as invalid, or clipped to a
18871887
very small positive number.
18881888

lib/matplotlib/axes/_base.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
12471247
12481248
See `.set_anchor` for further details.
12491249
1250-
share : bool, optional, default: False
1250+
share : bool, default: False
12511251
If ``True``, apply the settings to all shared Axes.
12521252
12531253
See Also
@@ -1309,7 +1309,7 @@ def set_adjustable(self, adjustable, share=False):
13091309
If 'box', change the physical dimensions of the Axes.
13101310
If 'datalim', change the ``x`` or ``y`` data limits.
13111311
1312-
share : bool, optional, default: False
1312+
share : bool, default: False
13131313
If ``True``, apply the settings to all shared Axes.
13141314
13151315
See Also
@@ -1443,7 +1443,7 @@ def set_anchor(self, anchor, share=False):
14431443
| 'SW' | 'S' | 'SE' |
14441444
+------+------+------+
14451445
1446-
share : bool, optional, default: False
1446+
share : bool, default: False
14471447
If ``True``, apply the settings to all shared Axes.
14481448
14491449
See Also
@@ -1664,7 +1664,7 @@ def axis(self, *args, emit=True, **kwargs):
16641664
``xmax-xmin == ymax-ymin``.
16651665
======== ==========================================================
16661666
1667-
emit : bool, optional, default *True*
1667+
emit : bool, default: True
16681668
Whether observers are notified of the axis limit change.
16691669
This option is passed on to `~.Axes.set_xlim` and
16701670
`~.Axes.set_ylim`.
@@ -2092,7 +2092,7 @@ def update_datalim(self, xys, updatex=True, updatey=True):
20922092
The points to include in the data limits Bbox. This can be either
20932093
a list of (x, y) tuples or a Nx2 array.
20942094
2095-
updatex, updatey : bool, optional, default *True*
2095+
updatex, updatey : bool, default: True
20962096
Whether to update the x/y limits.
20972097
"""
20982098
xys = np.asarray(xys)
@@ -2370,12 +2370,12 @@ def autoscale(self, enable=True, axis='both', tight=None):
23702370
23712371
Parameters
23722372
----------
2373-
enable : bool or None, optional, default: True
2373+
enable : bool or None, default: True
23742374
True turns autoscaling on, False turns it off.
23752375
None leaves the autoscaling state unchanged.
2376-
axis : {'both', 'x', 'y'}, optional, default: 'both'
2376+
axis : {'both', 'x', 'y'}, default: 'both'
23772377
Which axis to operate on.
2378-
tight : bool or None, optional, default: None
2378+
tight : bool or None, default: None
23792379
If True, first set the margins to zero. Then, this argument is
23802380
forwarded to `autoscale_view` (regardless of its value); see the
23812381
description of its behavior there.
@@ -3174,14 +3174,14 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False,
31743174
The right xlim in data coordinates. Passing *None* leaves the
31753175
limit unchanged.
31763176
3177-
emit : bool, optional, default: True
3177+
emit : bool, default: True
31783178
Whether to notify observers of limit change.
31793179
3180-
auto : bool or None, optional, default: False
3180+
auto : bool or None, default: False
31813181
Whether to turn on autoscaling of the x-axis. True turns on,
31823182
False turns off, None leaves unchanged.
31833183
3184-
xmin, xmax : scalar, optional
3184+
xmin, xmax : float, optional
31853185
They are equivalent to left and right respectively,
31863186
and it is an error to pass both *xmin* and *left* or
31873187
*xmax* and *right*.
@@ -3350,7 +3350,7 @@ def set_xticks(self, ticks, minor=False):
33503350
----------
33513351
ticks : list
33523352
List of x-axis tick locations.
3353-
minor : bool, optional, default: False
3353+
minor : bool, default: False
33543354
If ``False`` sets major ticks, if ``True`` sets minor ticks.
33553355
"""
33563356
ret = self.xaxis.set_ticks(ticks, minor=minor)
@@ -3555,10 +3555,10 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False,
35553555
The top ylim in data coordinates. Passing *None* leaves the
35563556
limit unchanged.
35573557
3558-
emit : bool, optional, default: True
3558+
emit : bool, default: True
35593559
Whether to notify observers of limit change.
35603560
3561-
auto : bool or None, optional, default: False
3561+
auto : bool or None, default: False
35623562
Whether to turn on autoscaling of the y-axis. *True* turns on,
35633563
*False* turns off, *None* leaves unchanged.
35643564
@@ -3731,7 +3731,7 @@ def set_yticks(self, ticks, minor=False):
37313731
----------
37323732
ticks : list
37333733
List of y-axis tick locations
3734-
minor : bool, optional, default: False
3734+
minor : bool, default: False
37353735
If ``False`` sets major ticks, if ``True`` sets minor ticks.
37363736
"""
37373737
ret = self.yaxis.set_ticks(ticks, minor=minor)

lib/matplotlib/axes/_secondary_axes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def set_ticks(self, ticks, minor=False):
170170
----------
171171
ticks : list
172172
List of x-axis tick locations.
173-
minor : bool, optional, default: False
173+
minor : bool, default: False
174174
If ``False`` sets major ticks, if ``True`` sets minor ticks.
175175
"""
176176
ret = self._axis.set_ticks(ticks, minor=minor)
@@ -306,7 +306,7 @@ def set_xlabel(self, xlabel, fontdict=None, labelpad=None, **kwargs):
306306
xlabel : str
307307
The label text.
308308
309-
labelpad : scalar, optional, default: None
309+
labelpad : float, default: ``self.xaxis.labelpad``
310310
Spacing in points between the label and the x-axis.
311311
312312
Other Parameters
@@ -324,15 +324,15 @@ def set_xlabel(self, xlabel, fontdict=None, labelpad=None, **kwargs):
324324

325325
def set_ylabel(self, ylabel, fontdict=None, labelpad=None, **kwargs):
326326
"""
327-
Set the label for the x-axis.
327+
Set the label for the y-axis.
328328
329329
Parameters
330330
----------
331331
ylabel : str
332332
The label text.
333333
334-
labelpad : scalar, optional, default: None
335-
Spacing in points between the label and the x-axis.
334+
labelpad : scalar, default: ``self.yaxis.labelpad``
335+
Spacing in points between the label and the y-axis.
336336
337337
Other Parameters
338338
----------------

lib/matplotlib/backend_bases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3170,7 +3170,7 @@ def add_tool(self, tool, group, position=-1):
31703170
The tool to add, see `ToolManager.get_tool`.
31713171
group : str
31723172
The name of the group to add this tool to.
3173-
position : int, optional, default: -1
3173+
position : int, default: -1
31743174
The position within the group to place this tool.
31753175
"""
31763176
tool = self.toolmanager.get_tool(tool)

lib/matplotlib/collections.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -932,12 +932,11 @@ def legend_elements(self, prop="colors", num="auto",
932932
933933
Parameters
934934
----------
935-
prop : string, optional, default *"colors"*
936-
Can be *"colors"* or *"sizes"*. In case of *"colors"*, the legend
937-
handles will show the different colors of the collection. In case
938-
of "sizes", the legend will show the different sizes.
935+
prop : {"colors", "sizes"}, default: "colors"
936+
If "colors", the legend handles will show the different colors of
937+
the collection. If "sizes", the legend will show the different
938+
sizes.
939939
num : int, None, "auto" (default), array-like, or `~.ticker.Locator`,
940-
optional
941940
Target number of elements to create.
942941
If None, use all unique elements of the mappable array. If an
943942
integer, target to use *num* elements in the normed range.

lib/matplotlib/colors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,10 +1602,10 @@ def __init__(self, azdeg=315, altdeg=45, hsv_min_val=0, hsv_max_val=1,
16021602
16031603
Parameters
16041604
----------
1605-
azdeg : float, optional, default: 315 degrees (from the northwest)
1605+
azdeg : float, default: 315 degrees (from the northwest)
16061606
The azimuth (0-360, degrees clockwise from North) of the light
16071607
source.
1608-
altdeg : float, optional, default: 45 degrees
1608+
altdeg : float, default: 45 degrees
16091609
The altitude (0-90, degrees up from horizontal) of the light
16101610
source.
16111611

lib/matplotlib/contour.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def clabel(self, levels=None, *,
6464
A list of level values, that should be labeled. The list must be
6565
a subset of ``cs.levels``. If not given, all levels are labeled.
6666
67-
fontsize : str or float, optional
67+
fontsize : str or float, default: :rc:`font.size`
6868
Size in points or relative size e.g., 'smaller', 'x-large'.
6969
See `.Text.set_size` for accepted string values.
7070
@@ -80,17 +80,17 @@ def clabel(self, levels=None, *,
8080
- If a tuple of colors (string, float, rgb, etc), different labels
8181
will be plotted in different colors in the order specified.
8282
83-
inline : bool, optional, default: True
83+
inline : bool, default: True
8484
If ``True`` the underlying contour is removed where the label is
8585
placed.
8686
87-
inline_spacing : float, optional, default: 5
87+
inline_spacing : float, default: 5
8888
Space in pixels to leave on each side of label when placing inline.
8989
9090
This spacing will be exact for labels at locations where the
9191
contour is straight, less so for labels on curved contours.
9292
93-
fmt : str or dict, optional, default: '%1.3f'
93+
fmt : str or dict, default: '%1.3f'
9494
A format string for the label.
9595
9696
Alternatively, this can be a dictionary matching contour levels
@@ -114,11 +114,11 @@ def clabel(self, levels=None, *,
114114
Contour labels will be created as if mouse is clicked at each
115115
(x, y) position.
116116
117-
rightside_up : bool, optional, default: True
117+
rightside_up : bool, default: True
118118
If ``True``, label rotations will always be plus
119119
or minus 90 degrees from level.
120120
121-
use_clabeltext : bool, optional, default: False
121+
use_clabeltext : bool, default: False
122122
If ``True``, `.ClabelText` class (instead of `.Text`) is used to
123123
create labels. `ClabelText` recalculates rotation angles
124124
of texts during the drawing time, therefore this can be used if
@@ -461,10 +461,10 @@ def add_label_near(self, x, y, inline=True, inline_spacing=5,
461461
x, y : float
462462
The approximate location of the label.
463463
464-
inline : bool, optional, default: True
464+
inline : bool, default: True
465465
If *True* remove the segment of the contour beneath the label.
466466
467-
inline_spacing : int, optional, default: 5
467+
inline_spacing : int, default: 5
468468
Space in pixels to leave on each side of label when placing
469469
inline. This spacing will be exact for labels at locations where
470470
the contour is straight, less so for labels on curved contours.
@@ -1686,8 +1686,7 @@ def _initialize_x_y(self, z):
16861686
are not given explicitly via *levels*.
16871687
Defaults to `~.ticker.MaxNLocator`.
16881688
1689-
extend : {'neither', 'both', 'min', 'max'}, optional, default: \
1690-
'neither'
1689+
extend : {'neither', 'both', 'min', 'max'}, default: 'neither'
16911690
Determines the ``contourf``-coloring of values that are outside the
16921691
*levels* range.
16931692

lib/matplotlib/figure.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ def add_artist(self, artist, clip=False):
10271027
The artist to add to the figure. If the added artist has no
10281028
transform previously set, its transform will be set to
10291029
``figure.transFigure``.
1030-
clip : bool, optional, default: False
1030+
clip : bool, default: False
10311031
Whether the added artist should be clipped by the figure patch.
10321032
10331033
Returns
@@ -1414,7 +1414,7 @@ def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
14141414
14151415
Parameters
14161416
----------
1417-
nrows, ncols : int, optional, default: 1
1417+
nrows, ncols : int, default: 1
14181418
Number of rows/columns of the subplot grid.
14191419
14201420
sharex, sharey : bool or {'none', 'all', 'row', 'col'}, default: False
@@ -1432,7 +1432,7 @@ def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
14321432
first column subplot are created. To later turn other subplots'
14331433
ticklabels on, use `~matplotlib.axes.Axes.tick_params`.
14341434
1435-
squeeze : bool, optional, default: True
1435+
squeeze : bool, default: True
14361436
- If True, extra dimensions are squeezed out from the returned
14371437
array of Axes:
14381438
@@ -1841,12 +1841,13 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
18411841
s : str
18421842
The text string.
18431843
1844-
fontdict : dictionary, optional, default: None
1845-
A dictionary to override the default text properties. If fontdict
1846-
is None, the defaults are determined by your rc parameters. A
1847-
property in *kwargs* override the same property in fontdict.
1844+
fontdict : dict, optional
1845+
A dictionary to override the default text properties. If not given,
1846+
the defaults are determined by your rc parameters. Properties
1847+
passed as *kwargs* override the corresponding ones given in
1848+
*fontdict*.
18481849
1849-
withdash : boolean, optional, default: False
1850+
withdash : bool, default: False
18501851
Creates a `~matplotlib.text.TextWithDash` instance instead of a
18511852
`~matplotlib.text.Text` instance.
18521853
@@ -2298,19 +2299,19 @@ def ginput(self, n=1, timeout=30, show_clicks=True, mouse_add=1,
22982299
22992300
Parameters
23002301
----------
2301-
n : int, optional, default: 1
2302+
n : int, default: 1
23022303
Number of mouse clicks to accumulate. If negative, accumulate
23032304
clicks until the input is terminated manually.
2304-
timeout : scalar, optional, default: 30
2305+
timeout : scalar, default: 30 seconds
23052306
Number of seconds to wait before timing out. If zero or negative
23062307
will never timeout.
2307-
show_clicks : bool, optional, default: True
2308+
show_clicks : bool, default: True
23082309
If True, show a red cross at the location of each click.
2309-
mouse_add : {1, 2, 3, None}, optional, default: 1 (left click)
2310+
mouse_add : {1, 2, 3, None}, default: 1 (left click)
23102311
Mouse button used to add points.
2311-
mouse_pop : {1, 2, 3, None}, optional, default: 3 (right click)
2312+
mouse_pop : {1, 2, 3, None}, default: 3 (right click)
23122313
Mouse button used to remove the most recently added point.
2313-
mouse_stop : {1, 2, 3, None}, optional, default: 2 (middle click)
2314+
mouse_stop : {1, 2, 3, None}, default: 2 (middle click)
23142315
Mouse button used to stop input.
23152316
23162317
Returns

0 commit comments

Comments
 (0)