Skip to content

Commit e6e63b4

Browse files
authored
Merge pull request #23201 from timhoffm/doc-tricontour
Rework tricontour and tricontourf documentation
2 parents f8ab952 + c156886 commit e6e63b4

File tree

2 files changed

+20
-59
lines changed

2 files changed

+20
-59
lines changed

lib/matplotlib/tri/tricontour.py

+16-53
Original file line numberDiff line numberDiff line change
@@ -84,68 +84,31 @@ def _contour_args(self, args, kwargs):
8484
_docstring.interpd.update(_tricontour_doc="""
8585
Draw contour %(type)s on an unstructured triangular grid.
8686
87-
The triangulation can be specified in one of two ways; either ::
87+
Call signatures::
8888
89-
%(func)s(triangulation, ...)
89+
%(func)s(triangulation, Z, [levels], ...)
90+
%(func)s(x, y, Z, [levels], *, [triangles=triangles], [mask=mask], ...)
9091
91-
where *triangulation* is a `.Triangulation` object, or ::
92+
The triangular grid can be specified either by passing a `.Triangulation`
93+
object as the first parameter, or by passing the points *x*, *y* and
94+
optionally the *triangles* and a *mask*. See `.Triangulation` for an
95+
explanation of these parameters. If neither of *triangulation* or
96+
*triangles* are given, the triangulation is calculated on the fly.
9297
93-
%(func)s(x, y, ...)
94-
%(func)s(x, y, triangles, ...)
95-
%(func)s(x, y, triangles=triangles, ...)
96-
%(func)s(x, y, mask=mask, ...)
97-
%(func)s(x, y, triangles, mask=mask, ...)
98-
99-
in which case a `.Triangulation` object will be created. See that class'
100-
docstring for an explanation of these cases.
101-
102-
The remaining arguments may be::
103-
104-
%(func)s(..., Z)
105-
106-
where *Z* is the array of values to contour, one per point in the
107-
triangulation. The level values are chosen automatically.
108-
109-
::
110-
111-
%(func)s(..., Z, levels)
112-
113-
contour up to *levels+1* automatically chosen contour levels (*levels*
114-
intervals).
115-
116-
::
117-
118-
%(func)s(..., Z, levels)
119-
120-
draw contour %(type)s at the values specified in sequence *levels*, which must
121-
be in increasing order.
122-
123-
::
124-
125-
%(func)s(Z, **kwargs)
126-
127-
Use keyword arguments to control colors, linewidth, origin, cmap ... see below
128-
for more details.
98+
It is possible to pass *triangles* positionally, i.e.
99+
``%(func)s(x, y, triangles, Z, ...)``. However, this is discouraged. For more
100+
clarity, pass *triangles* via keyword argument.
129101
130102
Parameters
131103
----------
132104
triangulation : `.Triangulation`, optional
133-
The unstructured triangular grid.
134-
135-
If specified, then *x*, *y*, *triangles*, and *mask* are not accepted.
136-
137-
x, y : array-like, optional
138-
The coordinates of the values in *Z*.
139-
140-
triangles : (ntri, 3) array-like of int, optional
141-
For each triangle, the indices of the three points that make up the
142-
triangle, ordered in an anticlockwise manner. If not specified, the
143-
Delaunay triangulation is calculated.
105+
An already created triangular grid.
144106
145-
mask : (ntri,) array-like of bool, optional
146-
Which triangles are masked out.
107+
x, y, triangles, mask
108+
Parameters defining the triangular grid. See `.Triangulation`.
109+
This is mutually exclusive with specifying *triangulation*.
147110
148-
Z : 2D array-like
111+
Z : array-like
149112
The height values over which the contour is drawn.
150113
151114
levels : int or array-like, optional

lib/matplotlib/tri/tripcolor.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ def tripcolor(ax, *args, alpha=1.0, norm=None, cmap=None, vmin=None,
2121
optionally the *triangles* and a *mask*. See `.Triangulation` for an
2222
explanation of these parameters.
2323
24+
It is possible to pass the triangles positionally, i.e.
25+
``tripcolor(x, y, triangles, C, ...)``. However, this is discouraged.
26+
For more clarity, pass *triangles* via keyword argument.
27+
2428
If neither of *triangulation* or *triangles* are given, the triangulation
2529
is calculated on the fly. In this case, it does not make sense to provide
2630
colors at the triangle faces via *C* or *facecolors* because there are
@@ -53,12 +57,6 @@ def tripcolor(ax, *args, alpha=1.0, norm=None, cmap=None, vmin=None,
5357
defined at points.
5458
other_parameters
5559
All other parameters are the same as for `~.Axes.pcolor`.
56-
57-
Notes
58-
-----
59-
It is possible to pass the triangles positionally, i.e.
60-
``tripcolor(x, y, triangles, C, ...)``. However, this is discouraged.
61-
For more clarity, pass *triangles* via keyword argument.
6260
"""
6361
_api.check_in_list(['flat', 'gouraud'], shading=shading)
6462

0 commit comments

Comments
 (0)