8000 Improve formatting of defaults in docstrings. · matplotlib/matplotlib@ae1ce09 · GitHub
[go: up one dir, main page]

Skip to content

Commit ae1ce09

Browse files
committed
Improve formatting of defaults in docstrings.
1 parent 2e82a38 commit ae1ce09

File tree

8 files changed

+23
-33
lines changed

8 files changed

+23
-33
lines changed

lib/matplotlib/animation.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,9 @@ def setup(self, fig, outfile, dpi=None, frame_prefix=None,
411411
The figure to grab the rendered frames from.
412412
outfile : str
413413
The filename of the resulting movie file.
414-
dpi : float, optional
414+
dpi : float, default: ``fig.dpi``
415415
The dpi of the output file. This, with the figure size,
416416
controls the size in pixels of the resulting movie file.
417-
Default is ``fig.dpi``.
418417
frame_prefix : str, optional
419418
The filename prefix to use for temporary files. If None (the
420419
default), files are written to a temporary directory which is
@@ -1006,7 +1005,7 @@ class to use, such as 'ffmpeg'.
10061005
encoder. The default, None, means to use
10071006
:rc:`animation.[name-of-encoder]_args` for the builtin writers.
10081007
1009-
metadata : Dict[str, str], default {}
1008+
metadata : Dict[str, str], default: {}
10101009
Dictionary of keys and values for metadata to include in
10111010
the output file. Some keys that may be of use include:
10121011
title, artist, genre, subject, copyright, srcform, comment.

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7393,9 +7393,8 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
73937393
spectrum. 'angle' returns the phase spectrum without unwrapping.
73947394
'phase' returns the phase spectrum with unwrapping.
73957395
7396-
noverlap : int
7397-
The number of points of overlap between blocks. The
7398-
default value is 128.
7396+
noverlap : int, default: 128
7397+
The number of points of overlap between blocks.
73997398
74007399
scale : {'default', 'linear', 'dB'}
74017400
The scaling of the values in the *spec*. 'linear' is no scaling.

lib/matplotlib/cbook/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,14 +382,14 @@ def to_filehandle(fname, flag='r', return_opened=False, encoding=None):
382382
fname : str or path-like or file-like
383383
If `str` or `os.PathLike`, the file is opened using the flags specified
384384
by *flag* and *encoding*. If a file-like object, it is passed through.
385-
flag : str, default 'r'
385+
flag : str, default: 'r'
386386
Passed as the *mode* argument to `open` when *fname* is `str` or
387387
`os.PathLike`; ignored if *fname* is file-like.
388-
return_opened : bool, default False
388+
return_opened : bool, default: False
389389
If True, return both the file object and a boolean indicating whether
390390
this was a new file (that the caller needs to close). If False, return
391391
only the new file.
392-
encoding : str or None, default None
392+
encoding : str or None, default: None
393393
Passed as the *mode* argument to `open` when *fname* is `str` or
394394
`os.PathLike`; ignored if *fname* is file-like.
395395

lib/matplotlib/collections.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ def legend_elements(self, prop="colors", num="auto",
990990
the collection. If "sizes", the legend will show the different
991991
sizes. To set both, use *kwargs* to directly edit the `.Line2D`
992992
properties.
993-
num : int, None, "auto" (default), array-like, or `~.ticker.Locator`,
993+
num : int, None, "auto" (default), array-like, or `~.ticker.Locator`
994994
Target number of elements to create.
995995
If None, use all unique elements of the mappable array. If an
996996
integer, target to use *num* elements in the normed range.
@@ -1004,7 +1004,7 @@ def legend_elements(self, prop="colors", num="auto",
10041004
The format or formatter to use for the labels. If a string must be
10051005
a valid input for a `~.StrMethodFormatter`. If None (the default),
10061006
use a `~.ScalarFormatter`.
1007-
func : function, default *lambda x: x*
1007+
func : function, default: ``lambda x: x``
10081008
Function to calculate the labels. Often the size (or color)
10091009
argument to `~.Axes.scatter` will have been pre-processed by the
10101010
user using a function ``s = f(x)`` to make the markers visible;

lib/matplotlib/dates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,8 @@ def num2date(x, tz=None):
499499
Number of days (fraction part represents hours, minutes, seconds)
500500
since the epoch. See `.get_epoch` for the
501501
epoch, which can be changed by :rc:`date.epoch` or `.set_epoch`.
502-
tz : str, optional
503-
Timezone of *x* (defaults to :rc:`timezone`).
502+
tz : str, default: :rc:`timezone`
503+
Timezone of *x*.
504504
505505
Returns
506506
-------

lib/matplotlib/figure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,10 +673,10 @@ def suptitle(self, t, **kwargs):
673673
t : str
674674
The title text.
675675
676-
x : float, default 0.5
676+
x : float, default: 0.5
677677
The x location of the text in figure coordinates.
678678
679-
y : float, default 0.98
679+
y : float, default: 0.98
680680
The y location of the text in figure coordinates.
681681
682682
horizontalalignment, ha : {'center', 'left', right'}, default: 'center'

lib/matplotlib/mlab.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,10 @@ def stride_windows(x, n, noverlap=None, axis=0):
293293
----------
294294
x : 1D array or sequence
295295
Array or sequence containing the data.
296-
297296
n : int
298297
The number of data points in each window.
299-
300-
noverlap : int
298+
noverlap : int, default: 0 (no overlap)
301299
The overlap between adjacent windows.
302-
Default is 0 (no overlap)
303-
304300
axis : int
305301
The axis along which the windows will run.
306302
@@ -629,7 +625,7 @@ def _single_spectrum_helper(
629625
most efficient. This should *NOT* be used to get zero padding, or the
630626
scaling of the result will be incorrect; use *pad_to* for this instead.
631627
632-
detrend : {'none', 'mean', 'linear'} or callable, default 'none'
628+
detrend : {'none', 'mean', 'linear'} or callable, default: 'none'
633629
The function applied to each segment before fft-ing, designed to remove
634630
the mean or linear trend. Unlike in MATLAB, where the *detrend* parameter
635631
is a vector, in Matplotlib is it a function. The :mod:`~matplotlib.mlab`
@@ -669,9 +665,8 @@ def psd(x, NFFT=None, Fs=None, detrend=None, window=None,
669665
670666
%(PSD)s
671667
672-
noverlap : int
668+
noverlap : int, default: 0 (no overlap)
673669
The number of points of overlap between segments.
674-
The default value is 0 (no overlap).
675670
676671
Returns
677672
-------
@@ -729,9 +724,8 @@ def csd(x, y, NFFT=None, Fs=None, detrend=None, window=None,
729724
730725
%(PSD)s
731726
732-
noverlap : int
727+
noverlap : int, default: 0 (no overlap)
733728
The number of points of overlap between segments.
734-
The default value is 0 (no overlap).
735729
736730
Returns
737731
-------
@@ -845,9 +839,8 @@ def specgram(x, NFFT=None, Fs=None, detrend=None, window=None,
845839
846840
%(PSD)s
847841
848-
noverlap : int, optional
849-
The number of points of overlap between blocks. The default
850-
value is 128.
842+
noverlap : int, default: 128
843+
The number of points of overlap between blocks.
851844
mode : str, default: 'psd'
852845
What sort of spectrum to use:
853846
'psd'
@@ -928,9 +921,8 @@ def cohere(x, y, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning,
928921
929922
%(PSD)s
930923
931-
noverlap : int
932-
The number of points of overlap between blocks. The default value
933-
is 0 (no overlap).
924+
noverlap : int, default: 0 (no overlap)
925+
The number of points of overlap between segments.
934926
935927
Returns
936928
-------

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def __init__(self, *args, zs=0, zdir='z', depthshade=True, **kwargs):
394394
:class:`~matplotlib.collections.PatchCollection`. In addition,
395395
keywords *zs=0* and *zdir='z'* are available.
396396
397-
Also, the keyword argument "depthshade" is available to
397+
Also, the keyword argument *depthshade* is available to
398398
indicate whether or not to shade the patches in order to
399399
give the appearance of depth (default is *True*).
400400
This is typically desired in scatter plots.
@@ -460,7 +460,7 @@ def __init__(self, *args, zs=0, zdir='z', depthshade=True, **kwargs):
460460
:class:`~matplotlib.collections.PathCollection`. In addition,
461461
keywords *zs=0* and *zdir='z'* are available.
462462
463-
Also, the keyword argument "depthshade" is available to
463+
Also, the keyword argument *depthshade* is available to
464464
indicate whether or not to shade the patches in order to
465465
give the appearance of depth (default is *True*).
466466
This is typically desired in scatter plots.

0 commit comments

Comments
 (0)
0