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

Skip to content

Commit 15c1c47

Browse files
authored
Merge pull request #13177 from anntzer/signatures
Remove signatures that duplicate introspectable data.
2 parents 3061c05 + a9008f1 commit 15c1c47

File tree

5 files changed

+39
-105
lines changed

5 files changed

+39
-105
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 10 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -6110,12 +6110,9 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
61106110
"""
61116111
Create a pseudocolor plot with a non-regular rectangular grid.
61126112
6113-
Call signatures::
6113+
Call signature::
61146114
6115-
ax.pcolorfast(C, **kwargs)
6116-
ax.pcolorfast(xr, yr, C, **kwargs)
6117-
ax.pcolorfast(x, y, C, **kwargs)
6118-
ax.pcolorfast(X, Y, C, **kwargs)
6115+
ax.pcolorfast([X, Y], C, /, **kwargs)
61196116
61206117
This method is similar to ~.Axes.pcolor` and `~.Axes.pcolormesh`.
61216118
It's designed to provide the fastest pcolor-type plotting with the
@@ -6135,24 +6132,24 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
61356132
Parameters
61366133
----------
61376134
C : array-like(M, N)
6138-
A scalar 2D array. The values will be color-mapped.
6139-
*C* may be a masked array.
6135+
A 2D array or masked array. The values will be color-mapped.
6136+
This argument can only be passed positionally.
61406137
6141-
x, y : tuple or array-like
6138+
X, Y : tuple or array-like, default: ``(0, N)``, ``(0, M)``
61426139
*X* and *Y* are used to specify the coordinates of the
61436140
quadilaterals. There are different ways to do this:
61446141
6145-
- Use tuples ``xr=(xmin, xmax)`` and ``yr=(ymin, ymax)`` to define
6142+
- Use tuples ``X=(xmin, xmax)`` and ``Y=(ymin, ymax)`` to define
61466143
a *uniform rectiangular grid*.
61476144
61486145
The tuples define the outer edges of the grid. All individual
61496146
quadrilaterals will be of the same size. This is the fastest
61506147
version.
61516148
6152-
- Use 1D arrays *x*, *y* to specify a *non-uniform rectangular
6149+
- Use 1D arrays *X*, *Y* to specify a *non-uniform rectangular
61536150
grid*.
61546151
6155-
In this case *x* and *y* have to be monotonic 1D arrays of length
6152+
In this case *X* and *Y* have to be monotonic 1D arrays of length
61566153
*N+1* and *M+1*, specifying the x and y boundaries of the cells.
61576154
61586155
The speed is intermediate. Note: The grid is checked, and if
@@ -6169,7 +6166,7 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
61696166
produce faster and more compact output using ps, pdf, and
61706167
svg backends, however.
61716168
6172-
Leaving out *x* and *y* defaults to ``xr=(0, N)``, ``yr=(O, M)``.
6169+
These arguments can only be passed positionally.
61736170
61746171
cmap : str or `~matplotlib.colors.Colormap`, optional
61756172
A Colormap instance or registered colormap name. The colormap
@@ -6321,32 +6318,7 @@ def clabel(self, CS, *args, **kwargs):
63216318
return CS.clabel(*args, **kwargs)
63226319
clabel.__doc__ = mcontour.ContourSet.clabel.__doc__
63236320

6324-
@docstring.dedent_interpd
6325-
def table(self, **kwargs):
6326-
"""
6327-
Add a table to the current axes.
6328-
6329-
Call signature::
6330-
6331-
table(cellText=None, cellColours=None,
6332-
cellLoc='right', colWidths=None,
6333-
rowLabels=None, rowColours=None, rowLoc='left',
6334-
colLabels=None, colColours=None, colLoc='center',
6335-
loc='bottom', bbox=None)
6336-
6337-
Returns a :class:`matplotlib.table.Table` instance. Either `cellText`
6338-
or `cellColours` must be provided. For finer grained control over
6339-
tables, use the :class:`~matplotlib.table.Table` class and add it to
6340-
the axes with :meth:`~matplotlib.axes.Axes.add_table`.
6341-
6342-
Thanks to John Gill for providing the class and table.
6343-
6344-
kwargs control the :class:`~matplotlib.table.Table`
6345-
properties:
6346-
6347-
%(Table)s
6348-
"""
6349-
return mtable.table(self, **kwargs)
6321+
table = mtable.table
63506322

63516323
#### Data analysis
63526324

@@ -6983,12 +6955,6 @@ def psd(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
69836955
r"""
69846956
Plot the power spectral density.
69856957
6986-
Call signature::
6987-
6988-
psd(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
6989-
window=mlab.window_hanning, noverlap=0, pad_to=None,
6990-
sides='default', scale_by_freq=None, return_line=None, **kwargs)
6991-
69926958
The power spectral density :math:`P_{xx}` by Welch's average
69936959
periodogram method. The vector *x* is divided into *NFFT* length
69946960
segments. Each segment is detrended by function *detrend* and
@@ -7106,12 +7072,6 @@ def csd(self, x, y, NFFT=None, Fs=None, Fc=None, detrend=None,
71067072
"""
71077073
Plot the cross-spectral density.
71087074
7109-
Call signature::
7110-
7111-
csd(x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
7112-
window=mlab.window_hanning, noverlap=0, pad_to=None,
7113-
sides='default', scale_by_freq=None, return_line=None, **kwargs)
7114-
71157075
The cross spectral density :math:`P_{xy}` by Welch's average
71167076
periodogram method. The vectors *x* and *y* are divided into
71177077
*NFFT* length segments. Each segment is detrended by function
@@ -7218,11 +7178,6 @@ def magnitude_spectrum(self, x, Fs=None, Fc=None, window=None,
72187178
"""
72197179
Plot the magnitude spectrum.
72207180
7221-
Call signature::
7222-
7223-
magnitude_spectrum(x, Fs=2, Fc=0, window=mlab.window_hanning,
7224-
pad_to=None, sides='default', **kwargs)
7225-
72267181
Compute the magnitude spectrum of *x*. Data is padded to a
72277182
length of *pad_to* and the windowing function *window* is applied to
72287183
the signal.
@@ -7320,11 +7275,6 @@ def angle_spectrum(self, x, Fs=None, Fc=None, window=None,
73207275
"""
73217276
Plot the angle spectrum.
73227277
7323-
Call signature::
7324-
7325-
angle_spectrum(x, Fs=2, Fc=0, window=mlab.window_hanning,
7326-
pad_to=None, sides='default', **kwargs)
7327-
73287278
Compute the angle spectrum (wrapped phase spectrum) of *x*.
73297279
Data is padded to a length of *pad_to* and the windowing function
73307280
*window* is applied to the signal.
@@ -7402,11 +7352,6 @@ def phase_spectrum(self, x, Fs=None, Fc=None, window=None,
74027352
"""
74037353
Plot the phase spectrum.
74047354
7405-
Call signature::
7406-
7407-
phase_spectrum(x, Fs=2, Fc=0, window=mlab.window_hanning,
7408-
pad_to=None, sides='default', **kwargs)
7409-
74107355
Compute the phase spectrum (unwrapped angle spectrum) of *x*.
74117356
Data is padded to a length of *pad_to* and the windowing function
74127357
*window* is applied to the signal.
@@ -7551,14 +7496,6 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
75517496
"""
75527497
Plot a spectrogram.
75537498
7554-
Call signature::
7555-
7556-
specgram(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
7557-
window=mlab.window_hanning, noverlap=128,
7558-
cmap=None, xextent=None, pad_to=None, sides='default',
7559-
scale_by_freq=None, mode='default', scale='default',
7560-
**kwargs)
7561-
75627499
Compute and plot a spectrogram of data in *x*. Data are split into
75637500
*NFFT* length segments and the spectrum of each section is
75647501
computed. The windowing function *window* is applied to each

lib/matplotlib/mlab.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -669,15 +669,15 @@ def _single_spectrum_helper(x, mode, Fs=None, window=None, pad_to=None,
669669
This should *NOT* be used to get zero padding, or the scaling of the
670670
result will be incorrect. Use *pad_to* for this instead.
671671
672-
detrend : {'default', 'constant', 'mean', 'linear', 'none'} or callable
672+
detrend : {'none', 'mean', 'linear'} or callable, default 'none'
673673
The function applied to each segment before fft-ing, designed to
674674
remove the mean or linear trend. Unlike in MATLAB, where the
675675
*detrend* parameter is a vector, in Matplotlib is it a function.
676676
The :mod:`~matplotlib.mlab` module defines `.detrend_none`,
677677
`.detrend_mean`, and `.detrend_linear`, but you can use a custom
678678
function as well. You can also use a string to choose one of the
679-
functions. 'default', 'constant', and 'mean' call `.detrend_mean`.
680-
'linear' calls `.detrend_linear`. 'none' calls `.detrend_none`.
679+
functions: 'none' calls `.detrend_none`. 'mean' calls `.detrend_mean`.
680+
'linear' calls `.detrend_linear`.
681681
682682
scale_by_freq : bool, optional
683683
Specifies whether the resulting density values should be scaled
@@ -693,12 +693,6 @@ def psd(x, NFFT=None, Fs=None, detrend=None, window=None,
693693
r"""
694694
Compute the power spectral density.
695695
696-
Call signature::
697-
698-
psd(x, NFFT=256, Fs=2, detrend=mlab.detrend_none,
699-
window=mlab.window_hanning, noverlap=0, pad_to=None,
700-
sides='default', scale_by_freq=None)
701-
702696
The power spectral density :math:`P_{xx}` by Welch's average
703697
periodogram method. The vector *x* is divided into *NFFT* length
704698
segments. Each segment is detrended by function *detrend* and
@@ -756,12 +750,6 @@ def csd(x, y, NFFT=None, Fs=None, detrend=None, window=None,
756750
"""
757751
Compute the cross-spectral density.
758752
759-
Call signature::
760-
761-
csd(x, y, NFFT=256, Fs=2, detrend=mlab.detrend_none,
762-
window=mlab.window_hanning, noverlap=0, pad_to=None,
763-
sides='default', scale_by_freq=None)
764-
765753
The cross spectral density :math:`P_{xy}` by Welch's average
766754
periodogram method. The vectors *x* and *y* are divided into
767755
*NFFT* length segments. Each segment is detrended by function

lib/matplotlib/pyplot.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,8 +1448,7 @@ def xticks(ticks=None, labels=None, **kwargs):
14481448
14491449
Call signatures::
14501450
1451-
locs, labels = xticks() # Get locations and labels
1452-
1451+
locs, labels = xticks() # Get locations and labels
14531452
xticks(ticks, [labels], **kwargs) # Set locations and labels
14541453
14551454
Parameters
@@ -1525,8 +1524,7 @@ def yticks(ticks=None, labels=None, **kwargs):
15251524
15261525
Call signatures::
15271526
1528-
locs, labels = yticks() # Get locations and labels
1529-
1527+
locs, labels = yticks() # Get locations and labels
15301528
yticks(ticks, [labels], **kwargs) # Set locations and labels
15311529
15321530
Parameters
@@ -2926,8 +2924,18 @@ def streamplot(
29262924

29272925
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
29282926
@docstring.copy_dedent(Axes.table)
2929-
def table(**kwargs):
2930-
return gca().table(**kwargs)
2927+
def table(
2928+
cellText=None, cellColours=None, cellLoc='right',
2929+
colWidths=None, rowLabels=None, rowColours=None,
2930+
rowLoc='left', colLabels=None, colColours=None,
2931+
colLoc='center', loc='bottom', bbox=None, edges='closed',
2932+
**kwargs):
2933+
return gca().table(
2934+
cellText=cellText, cellColours=cellColours, cellLoc=cellLoc,
2935+
colWidths=colWidths, rowLabels=rowLabels,
2936+
rowColours=rowColours, rowLoc=rowLoc, colLabels=colLabels,
2937+
colColours=colColours, colLoc=colLoc, loc=loc, bbox=bbox,
2938+
edges=edges, **kwargs)
29312939

29322940

29332941
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.

lib/matplotlib/table.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,10 @@ def get_celld(self):
656656
return self._cells
657657

658658

659+
docstring.interpd.update(Table=artist.kwdoc(Table))
660+
661+
662+
@docstring.dedent_interpd
659663
def table(ax,
660664
cellText=None, cellColours=None,
661665
cellLoc='right', colWidths=None,
@@ -675,6 +679,9 @@ def table(ax,
675679
using *rowLabels*, *rowColours*, *rowLoc* and *colLabels*, *colColours*,
676680
*colLoc* respectively.
677681
682+
For finer grained control over tables, use the `.Table` class and add it to
683+
the axes with `.Axes.add_table`.
684+
678685
Parameters
679686
----------
680687
cellText : 2D list of str, optional
@@ -726,13 +733,14 @@ def table(ax,
726733
Other Parameters
727734
----------------
728735
**kwargs
729-
`.Artist` properties.
736+
`.Table` properties.
737+
738+
%(Table)s
730739
731740
Returns
732741
-------
733742
table : `~matplotlib.table.Table`
734743
The created table.
735-
736744
"""
737745

738746
if cellColours is None and cellText is None:
@@ -829,6 +837,3 @@ def table(ax,
829837

830838
ax.add_table(table)
831839
return table
832-
833-
834-
docstring.interpd.update(Table=artist.kwdoc(Table))

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,19 +2734,15 @@ def calc_arrow(uvw, angle=15):
27342734

27352735
def voxels(self, *args, facecolors=None, edgecolors=None, **kwargs):
27362736
"""
2737-
ax.voxels([x, y, z,] /, filled, **kwargs)
2737+
ax.voxels([x, y, z,] /, filled, facecolors=None, edgecolors=None, \
2738+
**kwargs)
27382739
27392740
Plot a set of filled voxels
27402741
27412742
All voxels are plotted as 1x1x1 cubes on the axis, with filled[0,0,0]
27422743
placed with its lower corner at the origin. Occluded faces are not
27432744
plotted.
27442745
2745-
Call signatures::
2746-
2747-
voxels(filled, facecolors=fc, edgecolors=ec, **kwargs)
2748-
voxels(x, y, z, filled, facecolors=fc, edgecolors=ec, **kwargs)
2749-
27502746
.. versionadded:: 2.1
27512747
27522748
Parameters

0 commit comments

Comments
 (0)