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

Skip to content

Commit b5e4f32

Browse files
committed
More docstrings cleanup.
1 parent 4616f70 commit b5e4f32

File tree

11 files changed

+122
-181
lines changed

11 files changed

+122
-181
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 80 additions & 112 deletions
Large diffs are not rendered by default.

lib/matplotlib/axes/_base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2990,7 +2990,7 @@ def tick_params(self, axis='both', **kwargs):
29902990
29912991
Examples
29922992
--------
2993-
Usage ::
2993+
::
29942994
29952995
ax.tick_params(direction='out', length=6, width=2, colors='r',
29962996
grid_color='r', grid_alpha=0.5)
@@ -3818,8 +3818,8 @@ def xaxis_date(self, tz=None):
38183818
38193819
Parameters
38203820
----------
3821-
tz : str or `tzinfo` instance, optional
3822-
Timezone. Defaults to :rc:`timezone`.
3821+
tz : str or `tzinfo`, default: :rc:`timezone`
3822+
Timezone.
38233823
"""
38243824
# should be enough to inform the unit conversion interface
38253825
# dates are coming in
@@ -3831,8 +3831,8 @@ def yaxis_date(self, tz=None):
38313831
38323832
Parameters
38333833
----------
3834-
tz : str or `tzinfo` instance, optional
3835-
Timezone. Defaults to :rc:`timezone`.
3834+
tz : str or `tzinfo`, default: :rc:`timezone`
3835+
Timezone.
38363836
"""
38373837
self.yaxis.axis_date(tz)
38383838

lib/matplotlib/backend_bases.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2614,7 +2614,6 @@ class NavigationToolbar2:
26142614
'button_press_event' and 'button_release_event'. See
26152615
:meth:`FigureCanvasBase.mpl_connect` for more information
26162616
2617-
26182617
They must also define
26192618
26202619
:meth:`save_figure`

lib/matplotlib/colorbar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,8 @@ class ColorbarBase(_ColorbarMappableDummy):
399399
----------
400400
ax : `~matplotlib.axes.Axes`
401401
The `~.axes.Axes` instance in which the colorbar is drawn.
402-
cmap : `~matplotlib.colors.Colormap` or None
403-
The colormap to use. If *None*, use :rc:`image.cmap`.
402+
cmap : `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
403+
The colormap to use.
404404
norm : `~matplotlib.colors.Normalize`
405405
406406
alpha : float

lib/matplotlib/contour.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,15 +1616,13 @@ def _initialize_x_y(self, z):
16161616
16171617
Other Parameters
16181618
----------------
1619-
corner_mask : bool, optional
1619+
corner_mask : bool, default: :rc:`contour.corner_mask`
16201620
Enable/disable corner masking, which only has an effect if *Z* is
16211621
a masked array. If ``False``, any quad touching a masked point is
16221622
masked out. If ``True``, only the triangular corners of quads
16231623
nearest those points are always masked out, other triangular
16241624
corners comprising three unmasked points are contoured as usual.
16251625
1626-
Defaults to :rc:`contour.corner_mask`.
1627-
16281626
colors : color string or sequence of colors, optional
16291627
The colors of the levels, i.e. the lines for `.contour` and the
16301628
areas for `.contourf`.
@@ -1643,10 +1641,9 @@ def _initialize_x_y(self, z):
16431641
alpha : float, optional
16441642
The alpha blending value, between 0 (transparent) and 1 (opaque).
16451643
1646-
cmap : str or `.Colormap`, optional
1644+
cmap : str or `.Colormap`, default: :rc:`image.cmap`
16471645
A `.Colormap` instance or registered colormap name. The colormap
16481646
maps the level values to colors.
1649-
Defaults to :rc:`image.cmap`.
16501647
16511648
If both *colors* and *cmap* are given, an error is raised.
16521649
@@ -1740,7 +1737,7 @@ def _initialize_x_y(self, z):
17401737
however introduce rendering artifacts at chunk boundaries depending
17411738
on the backend, the *antialiased* flag and value of *alpha*.
17421739
1743-
linewidths : float or sequence of float, optional
1740+
linewidths : float or sequence of float, default: :rc:`lines.linewidth`
17441741
*Only applies to* `.contour`.
17451742
17461743
The line width of the contour lines.
@@ -1750,8 +1747,6 @@ def _initialize_x_y(self, z):
17501747
If a sequence, the levels in ascending order will be plotted with
17511748
the linewidths in the order specified.
17521749
1753-
Defaults to :rc:`lines.linewidth`.
1754-
17551750
linestyles : {*None*, 'solid', 'dashed', 'dashdot', 'dotted'}, optional
17561751
*Only applies to* `.contour`.
17571752

lib/matplotlib/dates.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -837,14 +837,12 @@ class AutoDateFormatter(ticker.Formatter):
837837
1. / (MINUTES_PER_DAY): rcParams['date.autoformat.minute'],
838838
1. / (SEC_PER_DAY): rcParams['date.autoformat.second'],
839839
1. / (MUSECONDS_PER_DAY): rcParams['date.autoformat.microsecond'],
840-
}
841-
840+
}
842841
843842
The algorithm picks the key in the dictionary that is >= the
844843
current scale and uses that format string. You can customize this
845844
dictionary by doing::
846845
847-
848846
>>> locator = AutoDateLocator()
849847
>>> formatter = AutoDateFormatter(locator)
850848
>>> formatter.scaled[1/(24.*60.)] = '%M:%S' # only show min and sec

lib/matplotlib/figure.py

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -677,12 +677,10 @@ def suptitle(self, t, **kwargs):
677677
The font weight of the text. See `.Text.set_weight` for possible
678678
values.
679679
680-
681680
Returns
682681
-------
683-
text
684-
The `.Text` instance of the title.
685-
682+
text
683+
The `.Text` instance of the title.
686684
687685
Other Parameters
688686
----------------
@@ -695,7 +693,6 @@ def suptitle(self, t, **kwargs):
695693
**kwargs
696694
Additional kwargs are :class:`matplotlib.text.Text` properties.
697695
698-
699696
Examples
700697
--------
701698
>>> fig.suptitle('This is the figure title', fontsize=12)
@@ -776,20 +773,20 @@ def figimage(self, X, xo=0, yo=0, alpha=None, norm=None, cmap=None,
776773
alpha : None or float
777774
The alpha blending value.
778775
779-
norm : :class:`matplotlib.colors.Normalize`
776+
norm : `matplotlib.colors.Normalize`
780777
A :class:`.Normalize` instance to map the luminance to the
781778
interval [0, 1].
782779
783-
cmap : str or :class:`matplotlib.colors.Colormap`
784-
The colormap to use. Default: :rc:`image.cmap`.
780+
cmap : str or `matplotlib.colors.Colormap`, default: :rc:`image.cmap`
781+
The colormap to use.
785782
786783
vmin, vmax : scalar
787784
If *norm* is not given, these values set the data limits for the
788785
colormap.
789786
790-
origin : {'upper', 'lower'}
787+
origin : {'upper', 'lower'}, default: :rc:`image.origin`
791788
Indicates where the [0, 0] index of the array is in the upper left
792-
or lower left corner of the axes. Defaults to :rc:`image.origin`.
789+
or lower left corner of the axes.
793790
794791
resize : bool
795792
If *True*, resize the figure to match the given image size.
@@ -805,22 +802,21 @@ def figimage(self, X, xo=0, yo=0, alpha=None, norm=None, cmap=None,
805802
806803
Notes
807804
-----
808-
figimage complements the axes image
809-
(:meth:`~matplotlib.axes.Axes.imshow`) which will be resampled
810-
to fit the current axes. If you want a resampled image to
811-
fill the entire figure, you can define an
812-
:class:`~matplotlib.axes.Axes` with extent [0, 0, 1, 1].
813-
805+
figimage complements the axes image (`~matplotlib.axes.Axes.imshow`)
806+
which will be resampled to fit the current axes. If you want
807+
a resampled image to fill the entire figure, you can define an
808+
`~matplotlib.axes.Axes` with extent [0, 0, 1, 1].
814809
815-
Examples::
810+
Examples
811+
--------
812+
::
816813
817814
f = plt.figure()
818815
nx = int(f.get_figwidth() * f.dpi)
819816
ny = int(f.get_figheight() * f.dpi)
820817
data = np.random.random((ny, nx))
821818
f.figimage(data)
822819
plt.show()
823-
824820
"""
825821
if resize:
826822
dpi = self.get_dpi()
@@ -2109,13 +2105,11 @@ def savefig(self, fname, *, transparent=None, **kwargs):
21092105
21102106
Whether the image should be stored as a progressive JPEG file.
21112107
2112-
facecolor : color or None, optional
2113-
The facecolor of the figure; if *None*, defaults to
2114-
:rc:`savefig.facecolor`.
2108+
facecolor : color, default: :rc:`savefig.facecolor`
2109+
The facecolor of the figure.
21152110
2116-
edgecolor : color or None, optional
2117-
The edgecolor of the figure; if *None*, defaults to
2118-
:rc:`savefig.edgecolor`
2111+
edgecolor : color, default: :rc:`savefig.edgecolor`
2112+
The edgecolor of the figure.
21192113
21202114
orientation : {'landscape', 'portrait'}
21212115
Currently only supported by the postscript backend.

lib/matplotlib/pyplot.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,6 @@ def axes(arg=None, **kwargs):
730730
The axis will have the same limits, ticks, and scale as the axis
731731
of the shared axes.
732732
733-
734733
label : str
735734
A label for the returned axes.
736735
@@ -1114,27 +1113,19 @@ def subplot2grid(shape, loc, rowspan=1, colspan=1, fig=None, **kwargs):
11141113
11151114
Parameters
11161115
----------
1117-
shape : sequence of 2 ints
1118-
Shape of grid in which to place axis.
1119-
First entry is number of rows, second entry is number of columns.
1120-
1121-
loc : sequence of 2 ints
1122-
Location to place axis within grid.
1123-
First entry is row number, second entry is column number.
1124-
1116+
shape : (int, int)
1117+
Number of rows and of columns of the grid in which to place axis.
1118+
loc : (int, int)
1119+
Row number and column number of the axis location within the grid.
11251120
rowspan : int
11261121
Number of rows for the axis to span to the right.
1127-
11281122
colspan : int
11291123
Number of columns for the axis to span downwards.
1130-
11311124
fig : `Figure`, optional
11321125
Figure to place axis in. Defaults to current figure.
1133-
11341126
**kwargs
11351127
Additional keyword arguments are handed to `add_subplot`.
11361128
1137-
11381129
Notes
11391130
-----
11401131
The following call ::
@@ -1143,8 +1134,8 @@ def subplot2grid(shape, loc, rowspan=1, colspan=1, fig=None, **kwargs):
11431134
11441135
is identical to ::
11451136
1146-
gridspec=GridSpec(shape[0], shape[1])
1147-
subplotspec=gridspec.new_subplotspec(loc, rowspan, colspan)
1137+
gridspec = GridSpec(shape[0], shape[1])
1138+
subplotspec = gridspec.new_subplotspec(loc, rowspan, colspan)
11481139
subplot(subplotspec)
11491140
"""
11501141

@@ -1804,7 +1795,6 @@ def colormaps():
18041795
black-blue-white-red-black
18051796
================ =================================================
18061797
1807-
18081798
Other miscellaneous schemes:
18091799
18101800
============= =======================================================

lib/matplotlib/stackplot.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ def stackplot(axes, x, *args,
5252
**kwargs
5353
All other keyword arguments are passed to `Axes.fill_between()`.
5454
55-
5655
Returns
5756
-------
5857
list : list of `.PolyCollection`

lib/mpl_toolkits/axes_grid1/inset_locator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ def zoomed_inset_axes(parent_axes, zoom, loc='upper right',
549549
coordinates (i.e., "zoomed in"), while *zoom* < 1 will shrink the
550550
coordinates (i.e., "zoomed out").
551551
552-
loc : int or str, optional, default to 1
552+
loc : int or str, optional, default: 'upper right'
553553
Location to place the inset axes. The valid locations are::
554554
555555
'upper right' : 1,

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,18 +2459,16 @@ def quiver(self, *args,
24592459
----------
24602460
X, Y, Z : array-like
24612461
The x, y and z coordinates of the arrow locations (default is
2462-
tail of arrow; see *pivot* kwarg)
2462+
tail of arrow; see *pivot* kwarg).
24632463
24642464
U, V, W : array-like
2465-
The x, y and z components of the arrow vectors
2465+
The x, y and z components of the arrow vectors.
24662466
2467-
length : float
2468-
The length of each quiver, default to 1.0, the unit is
2469-
the same with the axes
2467+
length : float, default: 1
2468+
The length of each quiver.
24702469
2471-
arrow_length_ratio : float
2472-
The ratio of the arrow head with respect to the quiver,
2473-
default to 0.3
2470+
arrow_length_ratio : float, default: 0.3
2471+
The ratio of the arrow head with respect to the quiver.
24742472
24752473
pivot : {'tail', 'middle', 'tip'}, default: 'tail'
24762474
The part of the arrow that is at the grid point; the arrow

0 commit comments

Comments
 (0)