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

Skip to content

Commit d8423e9

Browse files
timhoffmandrew-fennell
authored andcommitted
Improve docstring of triplot() and PatchCollection
As part of #10148: Docstring update for Axes.triplot() and PatchCollection.
1 parent d1865e8 commit d8423e9

File tree

2 files changed

+33
-27
lines changed

2 files changed

+33
-27
lines changed

lib/matplotlib/collections.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,29 +1780,34 @@ class PatchCollection(Collection):
17801780
"""
17811781
A generic collection of patches.
17821782
1783-
This makes it easier to assign a colormap to a heterogeneous
1783+
PatchCollection draws faster than a large number of equivalent individual
1784+
Patches. It also makes it easier to assign a colormap to a heterogeneous
17841785
collection of patches.
1785-
1786-
This also may improve plotting speed, since PatchCollection will
1787-
draw faster than a large number of patches.
17881786
"""
17891787

17901788
def __init__(self, patches, match_original=False, **kwargs):
17911789
"""
1792-
*patches*
1793-
a sequence of Patch objects. This list may include
1790+
Parameters
1791+
----------
1792+
patches : list of `.Patch`
1793+
A sequence of Patch objects. This list may include
17941794
a heterogeneous assortment of different patch types.
17951795
1796-
*match_original*
1796+
match_original : bool, default: False
17971797
If True, use the colors and linewidths of the original
17981798
patches. If False, new colors may be assigned by
17991799
providing the standard collection arguments, facecolor,
18001800
edgecolor, linewidths, norm or cmap.
18011801
1802-
If any of *edgecolors*, *facecolors*, *linewidths*, *antialiaseds* are
1803-
None, they default to their `.rcParams` patch setting, in sequence
1804-
form.
1802+
**kwargs
1803+
All other parameters are forwarded to `.Collection`.
18051804
1805+
If any of *edgecolors*, *facecolors*, *linewidths*, *antialiaseds*
1806+
are None, they default to their `.rcParams` patch setting, in
1807+
sequence form.
1808+
1809+
Notes
1810+
-----
18061811
The use of `~matplotlib.cm.ScalarMappable` functionality is optional.
18071812
If the `~matplotlib.cm.ScalarMappable` matrix ``_A`` has been set (via
18081813
a call to `~.ScalarMappable.set_array`), at draw time a call to scalar

lib/matplotlib/tri/triplot.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,27 @@
66

77
def triplot(ax, *args, **kwargs):
88
"""
9-
Draw a unstructured triangular grid as lines and/or markers.
9+
Draw an unstructured triangular grid as lines and/or markers.
1010
11-
The triangulation to plot can be specified in one of two ways; either::
11+
Call signatures::
1212
1313
triplot(triangulation, ...)
14-
15-
where triangulation is a `.Triangulation` object, or
16-
17-
::
18-
19-
triplot(x, y, ...)
20-
triplot(x, y, triangles, ...)
21-
triplot(x, y, triangles=triangles, ...)
22-
triplot(x, y, mask=mask, ...)
23-
triplot(x, y, triangles, mask=mask, ...)
24-
25-
in which case a Triangulation object will be created. See `.Triangulation`
26-
for a explanation of these possibilities.
27-
28-
The remaining args and kwargs are the same as for `~.Axes.plot`.
14+
triplot(x, y, [triangles], *, [mask=mask], ...)
15+
16+
The triangular grid can be specified either by passing a `.Triangulation`
17+
object as the first parameter, or by passing the points *x*, *y* and
18+
optionally the *triangles* and a *mask*. If neither of *triangulation* or
19+
*triangles* are given, the triangulation is calculated on the fly.
20+
21+
Parameters
22+
----------
23+
triangulation : `.Triangulation`
24+
An already created triangular grid.
25+
x, y, triangles, mask
26+
Parameters defining the triangular grid. See `.Triangulation`.
27+
This is mutually exclusive with specifying *triangulation*.
28+
other_parameters
29+
All other args and kwargs are forwarded to `~.Axes.plot`.
2930
3031
Returns
3132
-------

0 commit comments

Comments
 (0)