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

Skip to content

Commit fd7e88e

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 4cdd071 commit fd7e88e

File tree

5 files changed

+32
-101
lines changed

5 files changed

+32
-101
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 7 additions & 72 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
@@ -6141,21 +6138,21 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
61416138
A scalar 2D array. The values will be color-mapped.
61426139
*C* may be a masked array.
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,8 +6169,6 @@ 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)``.
6176-
61776172
cmap : str or `~matplotlib.colors.Colormap`, optional
61786173
A Colormap instance or registered colormap name. The colormap
61796174
maps the *C* values to colors. Defaults to :rc:`image.cmap`.
@@ -6324,32 +6319,7 @@ def clabel(self, CS, *args, **kwargs):
63246319
return CS.clabel(*args, **kwargs)
63256320
clabel.__doc__ = mcontour.ContourSet.clabel.__doc__
63266321

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)
6322+
table = mtable.table
63536323

63546324
#### Data analysis
63556325

@@ -6986,12 +6956,6 @@ def psd(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
69866956
r"""
69876957
Plot the power spectral density.
69886958
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-
69956959
The power spectral density :math:`P_{xx}` by Welch's average
69966960
periodogram method. The vector *x* is divided into *NFFT* length
69976961
segments. Each segment is detrended by function *detrend* and
@@ -7109,12 +7073,6 @@ def csd(self, x, y, NFFT=None, Fs=None, Fc=None, detrend=None,
71097073
"""
71107074
Plot the cross-spectral density.
71117075
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-
71187076
The cross spectral density :math:`P_{xy}` by Welch's average
71197077
periodogram method. The vectors *x* and *y* are divided into
71207078
*NFFT* length segments. Each segment is detrended by function
@@ -7221,11 +7179,6 @@ def magnitude_spectrum(self, x, Fs=None, Fc=None, window=None,
72217179
"""
72227180
Plot the magnitude spectrum.
72237181
7224-
Call signature::
7225-
7226-
magnitude_spectrum(x, Fs=2, Fc=0, window=mlab.window_hanning,
7227-
pad_to=None, sides='default', **kwargs)
7228-
72297182
Compute the magnitude spectrum of *x*. Data is padded to a
72307183
length of *pad_to* and the windowing function *window* is applied to
72317184
the signal.
@@ -7323,11 +7276,6 @@ def angle_spectrum(self, x, Fs=None, Fc=None, window=None,
73237276
"""
73247277
Plot the angle spectrum.
73257278
7326-
Call signature::
7327-
7328-
angle_spectrum(x, Fs=2, Fc=0, window=mlab.window_hanning,
7329-
pad_to=None, sides='default', **kwargs)
7330-
73317279
Compute the angle spectrum (wrapped phase spectrum) of *x*.
73327280
Data is padded to a length of *pad_to* and the windowing function
73337281
*window* is applied to the signal.
@@ -7405,11 +7353,6 @@ def phase_spectrum(self, x, Fs=None, Fc=None, window=None,
74057353
"""
74067354
Plot the phase spectrum.
74077355
7408-
Call signature::
7409-
7410-
phase_spectrum(x, Fs=2, Fc=0, window=mlab.window_hanning,
7411-
pad_to=None, sides='default', **kwargs)
7412-
74137356
Compute the phase spectrum (unwrapped angle spectrum) of *x*.
74147357
Data is padded to a length of *pad_to* and the windowing function
74157358
*window* is applied to the signal.
@@ -7554,14 +7497,6 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
75547497
"""
75557498
Plot a spectrogram.
75567499
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-
75657500
Compute and plot a spectrogram of data in *x*. Data are split into
75667501
*NFFT* length segments and the spectrum of each section is
75677502
computed. The windowing function *window* is applied to each

lib/matplotlib/mlab.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -727,12 +727,6 @@ def psd(x, NFFT=None, Fs=None, detrend=None, window=None,
727727
r"""
728728
Compute the power spectral density.
729729
730-
Call signature::
731-
732-
psd(x, NFFT=256, Fs=2, detrend=mlab.detrend_none,
733-
window=mlab.window_hanning, noverlap=0, pad_to=None,
734-
sides='default', scale_by_freq=None)
735-
736730
The power spectral density :math:`P_{xx}` by Welch's average
737731
periodogram method. The vector *x* is divided into *NFFT* length
738732
segments. Each segment is detrended by function *detrend* and
@@ -793,12 +787,6 @@ def csd(x, y, NFFT=None, Fs=None, detrend=None, window=None,
793787
"""
794788
Compute the cross-spectral density.
795789
796-
Call signature::
797-
798-
csd(x, y, NFFT=256, Fs=2, detrend=mlab.detrend_none,
799-
window=mlab.window_hanning, noverlap=0, pad_to=None,
800-
sides='default', scale_by_freq=None)
801-
802790
The cross spectral density :math:`P_{xy}` by Welch's average
803791
periodogram method. The vectors *x* and *y* are divided into
804792
*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: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2735,19 +2735,14 @@ def calc_arrow(uvw, angle=15):
27352735

27362736
def voxels(self, *args, facecolors=None, edgecolors=None, **kwargs):
27372737
"""
2738-
ax.voxels([x, y, z,] /, filled, **kwargs)
2738+
ax.voxels([x, y, z,] /, filled, facecolors=fc, edgecolors=ec, **kwargs)
27392739
27402740
Plot a set of filled voxels
27412741
27422742
All voxels are plotted as 1x1x1 cubes on the axis, with filled[0,0,0]
27432743
placed with its lower corner at the origin. Occluded faces are not
27442744
plotted.
27452745
2746-
Call signatures::
2747-
2748-
voxels(filled, facecolors=fc, edgecolors=ec, **kwargs)
2749-
voxels(x, y, z, filled, facecolors=fc, edgecolors=ec, **kwargs)
2750-
27512746
.. versionadded:: 2.1
27522747
27532748
Parameters

0 commit comments

Comments
 (0)