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

Skip to content

Commit a9008f1

Browse files
committed
Remove signatures that duplicate introspectable data.
(For the case of Axes.table, one can just directly use the `matplotlib.table.table` function as the method.)
1 parent 99af9e3 commit a9008f1

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
@@ -6113,12 +6113,9 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
61136113
"""
61146114
Create a pseudocolor plot with a non-regular rectangular grid.
61156115
6116-
Call signatures::
6116+
Call signature::
61176117
6118-
ax.pcolorfast(C, **kwargs)
6119-
ax.pcolorfast(xr, yr, C, **kwargs)
6120-
ax.pcolorfast(x, y, C, **kwargs)
6121-
ax.pcolorfast(X, Y, C, **kwargs)
6118+
ax.pcolorfast([X, Y], C, /, **kwargs)
61226119
61236120
This method is similar to ~.Axes.pcolor` and `~.Axes.pcolormesh`.
61246121
It's designed to provide the fastest pcolor-type plotting with the
@@ -6138,24 +6135,24 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
61386135
Parameters
61396136
----------
61406137
C : array-like(M, N)
6141-
A scalar 2D array. The values will be color-mapped.
6142-
*C* may be a masked array.
6138+
A 2D array or masked array. The values will be color-mapped.
6139+
This argument can only be passed positionally.
61436140
6144-
x, y : tuple or array-like
6141+
X, Y : tuple or array-like, default: ``(0, N)``, ``(0, M)``
61456142
*X* and *Y* are used to specify the coordinates of the
61466143
quadilaterals. There are different ways to do this:
61476144
6148-
- Use tuples ``xr=(xmin, xmax)`` and ``yr=(ymin, ymax)`` to define
6145+
- Use tuples ``X=(xmin, xmax)`` and ``Y=(ymin, ymax)`` to define
61496146
a *uniform rectiangular grid*.
61506147
61516148
The tuples define the outer edges of the grid. All individual
61526149
quadrilaterals will be of the same size. This is the fastest
61536150
version.
61546151
6155-
- Use 1D arrays *x*, *y* to specify a *non-uniform rectangular
6152+
- Use 1D arrays *X*, *Y* to specify a *non-uniform rectangular
61566153
grid*.
61576154
6158-
In this case *x* and *y* have to be monotonic 1D arrays of length
6155+
In this case *X* and *Y* have to be monotonic 1D arrays of length
61596156
*N+1* and *M+1*, specifying the x and y boundaries of the cells.
61606157
61616158
The speed is intermediate. Note: The grid is checked, and if
@@ -6172,7 +6169,7 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
61726169
produce faster and more compact output using ps, pdf, and
61736170
svg backends, however.
61746171
6175-
Leaving out *x* and *y* defaults to ``xr=(0, N)``, ``yr=(O, M)``.
6172+
These arguments can only be passed positionally.
61766173
61776174
cmap : str or `~matplotlib.colors.Colormap`, optional
61786175
A Colormap instance or registered colormap name. The colormap
@@ -6324,32 +6321,7 @@ def clabel(self, CS, *args, **kwargs):
63246321
return CS.clabel(*args, **kwargs)
63256322
clabel.__doc__ = mcontour.ContourSet.clabel.__doc__
63266323

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

63546326
#### Data analysis
63556327

@@ -6986,12 +6958,6 @@ def psd(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
69866958
r"""
69876959
Plot the power spectral density.
69886960
6989-
Call signature::
6990-
6991-
psd(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
6992-
window=mlab.window_hanning, noverlap=0, pad_to=None,
6993-
sides='default', scale_by_freq=None, return_line=None, **kwargs)
6994-
69956961
The power spectral density :math:`P_{xx}` by Welch's average
69966962
periodogram method. The vector *x* is divided into *NFFT* length
69976963
segments. Each segment is detrended by function *detrend* and
@@ -7109,12 +7075,6 @@ def csd(self, x, y, NFFT=None, Fs=None, Fc=None, detrend=None,
71097075
"""
71107076
Plot the cross-spectral density.
71117077
7112-
Call signature::
7113-
7114-
csd(x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
7115-
window=mlab.window_hanning, noverlap=0, pad_to=None,
7116-
sides='default', scale_by_freq=None, return_line=None, **kwargs)
7117-
71187078
The cross spectral density :math:`P_{xy}` by Welch's average
71197079
periodogram method. The vectors *x* and *y* are divided into
71207080
*NFFT* length segments. Each segment is detrended by function
@@ -7221,11 +7181,6 @@ def magnitude_spectrum(self, x, Fs=None, Fc=None, window=None,
72217181
"""
72227182
Plot the magnitude spectrum.
72237183
7224-
Call signature::
7225-
7226-
magnitude_spectrum(x, Fs=2, Fc=0, window=mlab.window_hanning,
7227-
pad_to=None, sides='default', **kwargs)
7228-
72297184
Compute the magnitude spectrum of *x*. Data is padded to a
72307185
length of *pad_to* and the windowing function *window* is applied to
72317186
the signal.
@@ -7323,11 +7278,6 @@ def angle_spectrum(self, x, Fs=None, Fc=None, window=None,
73237278
"""
73247279
Plot the angle spectrum.
73257280
7326-
Call signature::
7327-
7328-
angle_spectrum(x, Fs=2, Fc=0, window=mlab.window_hanning,
7329-
pad_to=None, sides='default', **kwargs)
7330-
73317281
Compute the angle spectrum (wrapped phase spectrum) of *x*.
73327282
Data is padded to a length of *pad_to* and the windowing function
73337283
*window* is applied to the signal.
@@ -7405,11 +7355,6 @@ def phase_spectrum(self, x, Fs=None, Fc=None, window=None,
74057355
"""
74067356
Plot the phase spectrum.
74077357
7408-
Call signature::
7409-
7410-
phase_spectrum(x, Fs=2, Fc=0, window=mlab.window_hanning,
7411-
pad_to=None, sides='default', **kwargs)
7412-
74137358
Compute the phase spectrum (unwrapped angle spectrum) of *x*.
74147359
Data is padded to a length of *pad_to* and the windowing function
74157360
*window* is applied to the signal.
@@ -7554,14 +7499,6 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
75547499
"""
75557500
Plot a spectrogram.
75567501
7557-
Call signature::
7558-
7559-
specgram(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
7560-
window=mlab.window_hanning, noverlap=128,
7561-
cmap=None, xextent=None, pad_to=None, sides='default',
7562-
scale_by_freq=None, mode='default', scale='default',
7563-
**kwargs)
7564-
75657502
Compute and plot a spectrogram of data in *x*. Data are split into
75667503
*NFFT* length segments and the spectrum of each section is
75677504
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
@@ -1445,8 +1445,7 @@ def xticks(ticks=None, labels=None, **kwargs):
14451445
14461446
Call signatures::
14471447
1448-
locs, labels = xticks() # Get locations and labels
1449-
1448+
locs, labels = xticks() # Get locations and labels
14501449
xticks(ticks, [labels], **kwargs) # Set locations and labels
14511450
14521451
Parameters
@@ -1522,8 +1521,7 @@ def yticks(ticks=None, labels=None, **kwargs):
15221521
15231522
Call signatures::
15241523
1525-
locs, labels = yticks() # Get locations and labels
1526-
1524+
locs, labels = yticks() # Get locations and labels
15271525
yticks(ticks, [labels], **kwargs) # Set locations and labels
15281526
15291527
Parameters
@@ -2923,8 +2921,18 @@ def streamplot(
29232921

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

29292937

29302938
# 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)