Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e7fcb37

Browse filesBrowse files
authored
Merge pull request #16901 from anntzer/docs
Cleanup many docstrings.
2 parents faf1a42 + 6d95a8a commit e7fcb37
Copy full SHA for e7fcb37
Expand file treeCollapse file tree

28 files changed

+230
-286
lines changed

‎examples/images_contours_and_fields/tricontour_smooth_delaunay.py

Copy file name to clipboardExpand all lines: examples/images_contours_and_fields/tricontour_smooth_delaunay.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
1. Compute an extended mask with a `matplotlib.tri.TriAnalyzer`, which will
2020
exclude badly shaped (flat) triangles from the border of the
2121
triangulation. Apply the mask to the triangulation (using set_mask).
22-
2. Refine and interpolate the data using a
23-
`matplotlib.tri.UniformTriRefiner`.
22+
2. Refine and interpolate the data using a `matplotlib.tri.UniformTriRefiner`.
2423
3. Plot the refined data with `~.axes.Axes.tricontour`.
2524
2625
"""

‎lib/matplotlib/artist.py

Copy file name to clipboardExpand all lines: lib/matplotlib/artist.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ def set_gid(self, gid):
586586

587587
def get_snap(self):
588588
"""
589-
Returns the snap setting.
589+
Return the snap setting.
590590
591591
See `.set_snap` for details.
592592
"""
@@ -625,7 +625,7 @@ def set_snap(self, snap):
625625

626626
def get_sketch_params(self):
627627
"""
628-
Returns the sketch parameters for the artist.
628+
Return the sketch parameters for the artist.
629629
630630
Returns
631631
-------

‎lib/matplotlib/axes/_base.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+13-15Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,10 +1253,9 @@ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
12531253
See Also
12541254
--------
12551255
matplotlib.axes.Axes.set_adjustable
1256-
defining the parameter to adjust in order to meet the required
1257-
aspect.
1256+
Set how the Axes adjusts to achieve the required aspect ratio.
12581257
matplotlib.axes.Axes.set_anchor
1259-
defining the position in case of extra space.
1258+
Set the position in case of extra space.
12601259
"""
12611260
if cbook._str_equal(aspect, 'equal'):
12621261
aspect = 1
@@ -1286,22 +1285,21 @@ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
12861285

12871286
def get_adjustable(self):
12881287
"""
1289-
Returns the adjustable parameter, *{'box', 'datalim'}* that defines
1290-
which parameter the Axes will change to achieve a given aspect.
1288+
Return whether the Axes will adjust its physical dimension ('box') or
1289+
its data limits ('datalim') to achieve the desired aspect ratio.
12911290
12921291
See Also
12931292
--------
12941293
matplotlib.axes.Axes.set_adjustable
1295-
defining the parameter to adjust in order to meet the required
1296-
aspect.
1294+
Set how the Axes adjusts to achieve the required aspect ratio.
12971295
matplotlib.axes.Axes.set_aspect
1298-
for a description of aspect handling.
1296+
For a description of aspect handling.
12991297
"""
13001298
return self._adjustable
13011299

13021300
def set_adjustable(self, adjustable, share=False):
13031301
"""
1304-
Define which parameter the Axes will change to achieve a given aspect.
1302+
Set how the Axes adjusts to achieve the required aspect ratio.
13051303
13061304
Parameters
13071305
----------
@@ -1315,7 +1313,7 @@ def set_adjustable(self, adjustable, share=False):
13151313
See Also
13161314
--------
13171315
matplotlib.axes.Axes.set_aspect
1318-
for a description of aspect handling.
1316+
For a description of aspect handling.
13191317
13201318
Notes
13211319
-----
@@ -1512,12 +1510,11 @@ def apply_aspect(self, position=None):
15121510
See Also
15131511
--------
15141512
matplotlib.axes.Axes.set_aspect
1515-
for a description of aspect ratio handling.
1513+
For a description of aspect ratio handling.
15161514
matplotlib.axes.Axes.set_adjustable
1517-
defining the parameter to adjust in order to meet the required
1518-
aspect.
1515+
Set how the Axes adjusts to achieve the required aspect ratio.
15191516
matplotlib.axes.Axes.set_anchor
1520-
defining the position in case of extra space.
1517+
Set the position in case of extra space.
15211518
"""
15221519
if position is None:
15231520
position = self.get_position(original=True)
@@ -1787,7 +1784,8 @@ def get_yticklines(self):
17871784
# Adding and tracking artists
17881785

17891786
def _sci(self, im):
1790-
"""Set the current image.
1787+
"""
1788+
Set the current image.
17911789
17921790
This image will be the target of colormap functions like
17931791
`~.pyplot.viridis`, and other functions such as `~.pyplot.clim`. The

‎lib/matplotlib/axis.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axis.py
+15-18Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,8 +1961,8 @@ def _update_offset_text_position(self, bboxes, bboxes2):
19611961

19621962
def get_text_heights(self, renderer):
19631963
"""
1964-
Returns the amount of space one should reserve for text
1965-
above and below the axes. Returns a tuple (above, below)
1964+
Return how much space should be reserved for text above and below the
1965+
axes, as a pair of floats.
19661966
"""
19671967
bbox, bbox2 = self.get_ticklabel_extents(renderer)
19681968
# MGDTODO: Need a better way to get the pad
@@ -1983,16 +1983,16 @@ def get_text_heights(self, renderer):
19831983

19841984
def set_ticks_position(self, position):
19851985
"""
1986-
Set the ticks position (top, bottom, both, default or none)
1987-
both sets the ticks to appear on both positions, but does not
1988-
change the tick labels. 'default' resets the tick positions to
1989-
the default: ticks on both positions, labels at bottom. 'none'
1990-
can be used if you don't want any ticks. 'none' and 'both'
1991-
affect only the ticks, not the labels.
1986+
Set the ticks position.
19921987
19931988
Parameters
19941989
----------
19951990
position : {'top', 'bottom', 'both', 'default', 'none'}
1991+
'both' sets the ticks to appear on both positions, but does not
1992+
change the tick labels. 'default' resets the tick positions to
1993+
the default: ticks on both positions, labels at bottom. 'none'
1994+
can be used if you don't want any ticks. 'none' and 'both'
1995+
affect only the ticks, not the labels.
19961996
"""
19971997
cbook._check_in_list(['top', 'bottom', 'both', 'default', 'none'],
19981998
position=position)
@@ -2123,10 +2123,7 @@ def __init__(self, *args, **kwargs):
21232123
self.offset_text_position = 'left'
21242124

21252125
def contains(self, mouseevent):
2126-
"""Test whether the mouse event occurred in the y axis.
2127-
2128-
Returns *True* | *False*
2129-
"""
2126+
# docstring inherited
21302127
inside, info = self._default_contains(mouseevent)
21312128
if inside is not None:
21322129
return inside, info
@@ -2271,16 +2268,16 @@ def get_text_widths(self, renderer):
22712268

22722269
def set_ticks_position(self, position):
22732270
"""
2274-
Set the ticks position (left, right, both, default or none)
2275-
'both' sets the ticks to appear on both positions, but does not
2276-
change the tick labels. 'default' resets the tick positions to
2277-
the default: ticks on both positions, labels at left. 'none'
2278-
can be used if you don't want any ticks. 'none' and 'both'
2279-
affect only the ticks, not the labels.
2271+
Set the ticks position.
22802272
22812273
Parameters
22822274
----------
22832275
position : {'left', 'right', 'both', 'default', 'none'}
2276+
'both' sets the ticks to appear on both positions, but does not
2277+
change the tick labels. 'default' resets the tick positions to
2278+
the default: ticks on both positions, labels at left. 'none'
2279+
can be used if you don't want any ticks. 'none' and 'both'
2280+
affect only the ticks, not the labels.
22842281
"""
22852282
cbook._check_in_list(['left', 'right', 'both', 'default', 'none'],
22862283
position=position)

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ def get_gid(self):
826826

827827
def get_snap(self):
828828
"""
829-
Returns the snap setting, which can be:
829+
Return the snap setting, which can be:
830830
831831
* True: snap vertices to the nearest pixel center
832832
* False: leave vertices as-is

‎lib/matplotlib/backends/backend_pdf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pdf.py
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2484,9 +2484,7 @@ def savefig(self, figure=None, **kwargs):
24842484
figure.canvas = orig_canvas
24852485

24862486
def get_pagecount(self):
2487-
"""
2488-
Returns the current number of pages in the multipage pdf file.
2489-
"""
2487+
"""Return the current number of pages in the multipage pdf file."""
24902488
return len(self._file.pageList)
24912489

24922490
def attach_note(self, text, positionRect=[-100, -100, 0, 0]):

‎lib/matplotlib/backends/backend_pgf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pgf.py
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def _font_properties_str(prop):
152152

153153

154154
def make_pdf_to_png_converter():
155-
"""Returns a function that converts a pdf file to a png file."""
155+
"""Return a function that converts a pdf file to a png file."""
156156
if shutil.which("pdftocairo"):
157157
def cairo_convert(pdffile, pngfile, dpi):
158158
cmd = ["pdftocairo", "-singlefile", "-png", "-r", "%d" % dpi,
@@ -1152,7 +1152,5 @@ def savefig(self, figure=None, **kwargs):
11521152
figure.canvas = orig_canvas
11531153

11541154
def get_pagecount(self):
1155-
"""
1156-
Returns the current number of pages in the multipage pdf file.
1157-
"""
1155+
"""Return the current number of pages in the multipage pdf file."""
11581156
return self._n_figures

‎lib/matplotlib/cbook/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook/__init__.py
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ def contiguous_regions(mask):
12611261

12621262
def is_math_text(s):
12631263
"""
1264-
Returns whether the string *s* contains math expressions.
1264+
Return whether the string *s* contains math expressions.
12651265
12661266
This is done by checking whether *s* contains an even number of
12671267
non-escaped dollar signs.
@@ -1354,10 +1354,11 @@ def _reshape_2D(X, name):
13541354

13551355
def violin_stats(X, method, points=100, quantiles=None):
13561356
"""
1357-
Returns a list of dictionaries of data which can be used to draw a series
1357+
Return a list of dictionaries of data which can be used to draw a series
13581358
of violin plots.
13591359
1360-
See the Returns section below to view the required keys of the dictionary.
1360+
See the ``Returns`` section below to view the required keys of the
1361+
dictionary.
13611362
13621363
Users can skip this function and pass a user-defined set of dictionaries
13631364
with the same keys to `~.axes.Axes.violinplot` instead of using Matplotlib

‎lib/matplotlib/collections.py

Copy file name to clipboardExpand all lines: lib/matplotlib/collections.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def set_offset_position(self, offset_position):
514514

515515
def get_offset_position(self):
516516
"""
517-
Returns how offsets are applied for the collection. If
517+
Return how offsets are applied for the collection. If
518518
*offset_position* is 'screen', the offset is applied after the
519519
master transform has been applied, that is, the offsets are in
520520
screen coordinates. If offset_position is 'data', the offset
@@ -850,8 +850,7 @@ class _CollectionWithSizes(Collection):
850850

851851
def get_sizes(self):
852852
"""
853-
Returns the sizes of the elements in the collection. The
854-
value represents the 'area' of the element.
853+
Return the sizes ('areas') of the elements in the collection.
855854
856855
Returns
857856
-------

‎lib/matplotlib/figure.py

Copy file name to clipboardExpand all lines: lib/matplotlib/figure.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ def set_size_inches(self, w, h=None, forward=True):
886886

887887
def get_size_inches(self):
888888
"""
889-
Returns the current size of the figure in inches.
889+
Return the current size of the figure in inches.
890890
891891
Returns
892892
-------

‎lib/matplotlib/font_manager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/font_manager.py
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ def set_default_weight(self, weight):
10451045
# 0.0 (perfect match) and 1.0 (terrible match)
10461046
def score_family(self, families, family2):
10471047
"""
1048-
Returns a match score between the list of font families in
1048+
Return a match score between the list of font families in
10491049
*families* and the font family name *family2*.
10501050
10511051
An exact match at the head of the list returns 0.0.
@@ -1078,7 +1078,7 @@ def score_family(self, families, family2):
10781078

10791079
def score_style(self, style1, style2):
10801080
"""
1081-
Returns a match score between *style1* and *style2*.
1081+
Return a match score between *style1* and *style2*.
10821082
10831083
An exact match returns 0.0.
10841084
@@ -1095,7 +1095,7 @@ def score_style(self, style1, style2):
10951095

10961096
def score_variant(self, variant1, variant2):
10971097
"""
1098-
Returns a match score between *variant1* and *variant2*.
1098+
Return a match score between *variant1* and *variant2*.
10991099
11001100
An exact match returns 0.0, otherwise 1.0.
11011101
"""
@@ -1106,7 +1106,7 @@ def score_variant(self, variant1, variant2):
11061106

11071107
def score_stretch(self, stretch1, stretch2):
11081108
"""
1109-
Returns a match score between *stretch1* and *stretch2*.
1109+
Return a match score between *stretch1* and *stretch2*.
11101110
11111111
The result is the absolute value of the difference between the
11121112
CSS numeric values of *stretch1* and *stretch2*, normalized
@@ -1124,7 +1124,7 @@ def score_stretch(self, stretch1, stretch2):
11241124

11251125
def score_weight(self, weight1, weight2):
11261126
"""
1127-
Returns a match score between *weight1* and *weight2*.
1127+
Return a match score between *weight1* and *weight2*.
11281128
11291129
The result is 0.0 if both weight1 and weight 2 are given as strings
11301130
and have the same value.
@@ -1142,7 +1142,7 @@ def score_weight(self, weight1, weight2):
11421142

11431143
def score_size(self, size1, size2):
11441144
"""
1145-
Returns a match score between *size1* and *size2*.
1145+
Return a match score between *size1* and *size2*.
11461146
11471147
If *size2* (the size specified in the font file) is 'scalable', this
11481148
function always returns 0.0, since any font size can be generated.

‎lib/matplotlib/mathtext.py

Copy file name to clipboardExpand all lines: lib/matplotlib/mathtext.py
+6-7Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -443,17 +443,16 @@ def get_metrics(self, font, font_class, sym, fontsize, dpi, math=True):
443443
444444
Returns an object with the following attributes:
445445
446-
- *advance*: The advance distance (in points) of the glyph.
446+
- *advance*: The advance distance (in points) of the glyph.
447447
448-
- *height*: The height of the glyph in points.
448+
- *height*: The height of the glyph in points.
449449
450-
- *width*: The width of the glyph in points.
450+
- *width*: The width of the glyph in points.
451451
452-
- *xmin*, *xmax*, *ymin*, *ymax* - the ink rectangle of the glyph
452+
- *xmin*, *xmax*, *ymin*, *ymax* - the ink rectangle of the glyph
453453
454-
- *iceberg* - the distance from the baseline to the top of
455-
the glyph. This corresponds to TeX's definition of
456-
"height".
454+
- *iceberg* - the distance from the baseline to the top of
455+
the glyph. This corresponds to TeX's definition of "height".
457456
"""
458457
info = self._get_info(font, font_class, sym, fontsize, dpi, math)
459458
return info.metrics

‎lib/matplotlib/patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/patches.py
+3-17Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,30 +1020,16 @@ def __init__(self, xy, closed=True, **kwargs):
10201020
self.set_xy(xy)
10211021

10221022
def get_path(self):
1023-
"""
1024-
Get the path of the polygon
1025-
1026-
Returns
1027-
-------
1028-
Path
1029-
The `~.path.Path` object for the polygon.
1030-
"""
1023+
"""Get the `.Path` of the polygon."""
10311024
return self._path
10321025

10331026
def get_closed(self):
1034-
"""
1035-
Returns if the polygon is closed
1036-
1037-
Returns
1038-
-------
1039-
bool
1040-
If the path is closed
1041-
"""
1027+
"""Return whether the polygon is closed."""
10421028
return self._closed
10431029

10441030
def set_closed(self, closed):
10451031
"""
1046-
Set if the polygon is closed
1032+
Set whether the polygon is closed.
10471033
10481034
Parameters
10491035
----------

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.