Skip to content

Commit b2600c9

Browse files
committed
Reword a bit the contour docs.
1 parent 4cab2ec commit b2600c9

File tree

2 files changed

+36
-52
lines changed

2 files changed

+36
-52
lines changed

lib/matplotlib/contour.py

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,19 +1661,17 @@ def _initialize_x_y(self, z):
16611661
16621662
contour([X, Y,] Z, [levels], **kwargs)
16631663
1664-
:func:`~matplotlib.pyplot.contour` and
1665-
:func:`~matplotlib.pyplot.contourf` draw contour lines and
1666-
filled contours, respectively. Except as noted, function
1667-
signatures and return values are the same for both versions.
1668-
1664+
`.contour` and `.contourf` draw contour lines and filled contours,
1665+
respectively. Except as noted, function signatures and return values
1666+
are the same for both versions.
16691667
16701668
Parameters
16711669
----------
16721670
X, Y : array-like, optional
16731671
The coordinates of the values in *Z*.
16741672
16751673
*X* and *Y* must both be 2-D with the same shape as *Z* (e.g.
1676-
created via :func:`numpy.meshgrid`), or they must both be 1-D such
1674+
created via `numpy.meshgrid`), or they must both be 1-D such
16771675
that ``len(X) == M`` is the number of columns in *Z* and
16781676
``len(Y) == N`` is the number of rows in *Z*.
16791677
@@ -1705,8 +1703,7 @@ def _initialize_x_y(self, z):
17051703
nearest those points are always masked out, other triangular
17061704
corners comprising three unmasked points are contoured as usual.
17071705
1708-
Defaults to ``rcParams['contour.corner_mask']``, which defaults to
1709-
``True``.
1706+
Defaults to :rc:`contour.corner_mask`, which defaults to ``True``.
17101707
17111708
colors : color string or sequence of colors, optional
17121709
The colors of the levels, i.e. the lines for `.contour` and the
@@ -1756,15 +1753,14 @@ def _initialize_x_y(self, z):
17561753
*None* in the rcParam is currently handled as 'lower'.
17571754
17581755
extent : (x0, x1, y0, y1), optional
1759-
If *origin* is not *None*, then *extent* is interpreted as
1760-
in :func:`matplotlib.pyplot.imshow`: it gives the outer
1761-
pixel boundaries. In this case, the position of Z[0,0]
1762-
is the center of the pixel, not a corner. If *origin* is
1763-
*None*, then (*x0*, *y0*) is the position of Z[0,0], and
1764-
(*x1*, *y1*) is the position of Z[-1,-1].
1756+
If *origin* is not *None*, then *extent* is interpreted as in
1757+
`.imshow`: it gives the outer pixel boundaries. In this case, the
1758+
position of Z[0,0] is the center of the pixel, not a corner. If
1759+
*origin* is *None*, then (*x0*, *y0*) is the position of Z[0,0],
1760+
and (*x1*, *y1*) is the position of Z[-1,-1].
17651761
1766-
This keyword is not active if *X* and *Y* are specified in
1767-
the call to contour.
1762+
This argument is ignored if *X* and *Y* are specified in the call
1763+
to contour.
17681764
17691765
locator : ticker.Locator subclass, optional
17701766
The locator is used to determine the contour levels if they
@@ -1830,20 +1826,17 @@ def _initialize_x_y(self, z):
18301826
Hatching is supported in the PostScript, PDF, SVG and Agg
18311827
backends only.
18321828
1833-
18341829
Notes
18351830
-----
1836-
1. :func:`~matplotlib.pyplot.contourf` differs from the MATLAB
1837-
version in that it does not draw the polygon edges.
1838-
To draw edges, add line contours with
1839-
calls to :func:`~matplotlib.pyplot.contour`.
1831+
1. `.contourf` differs from the MATLAB version in that it does not draw
1832+
the polygon edges. To draw edges, add line contours with calls to
1833+
`.contour`.
18401834
1841-
2. contourf fills intervals that are closed at the top; that
1842-
is, for boundaries *z1* and *z2*, the filled region is::
1835+
2. `.contourf` fills intervals that are closed at the top; that is, for
1836+
boundaries *z1* and *z2*, the filled region is::
18431837
18441838
z1 < Z <= z2
18451839
1846-
There is one exception: if the lowest boundary coincides with
1847-
the minimum value of the *Z* array, then that minimum value
1848-
will be included in the lowest interval.
1840+
except for the lowest interval, which is closed on both sides (i.e.
1841+
it includes the lowest value).
18491842
"""

lib/matplotlib/tri/tricontour.py

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -94,44 +94,38 @@ def _contour_args(self, args, kwargs):
9494
def tricontour(ax, *args, **kwargs):
9595
"""
9696
Draw contours on an unstructured triangular grid.
97-
:func:`~matplotlib.pyplot.tricontour` and
98-
:func:`~matplotlib.pyplot.tricontourf` draw contour lines and
99-
filled contours, respectively. Except as noted, function
100-
signatures and return values are the same for both versions.
10197
102-
The triangulation can be specified in one of two ways; either::
98+
`.tricontour` and `.tricontourf` draw contour lines and filled contours,
99+
respectively. Except as noted, function signatures and return values are
100+
the same for both versions.
103101
104-
tricontour(triangulation, ...)
102+
The triangulation can be specified in one of two ways; either ::
105103
106-
where triangulation is a :class:`matplotlib.tri.Triangulation`
107-
object, or
104+
tricontour(triangulation, ...)
108105
109-
::
106+
where *triangulation* is a `matplotlib.tri.Triangulation` object, or ::
110107
111108
tricontour(x, y, ...)
112109
tricontour(x, y, triangles, ...)
113110
tricontour(x, y, triangles=triangles, ...)
114111
tricontour(x, y, mask=mask, ...)
115112
tricontour(x, y, triangles, mask=mask, ...)
116113
117-
in which case a Triangulation object will be created. See
118-
:class:`~matplotlib.tri.Triangulation` for a explanation of
119-
these possibilities.
114+
in which case a `.Triangulation` object will be created. See that class'
115+
docstring for an explanation of these cases.
120116
121117
The remaining arguments may be::
122118
123119
tricontour(..., Z)
124120
125-
where *Z* is the array of values to contour, one per point
126-
in the triangulation. The level values are chosen
127-
automatically.
121+
where *Z* is the array of values to contour, one per point in the
122+
triangulation. The level values are chosen automatically.
128123
129124
::
130125
131126
tricontour(..., Z, N)
132127
133-
contour up to *N+1* automatically chosen contour levels
134-
(*N* intervals).
128+
contour up to *N+1* automatically chosen contour levels (*N* intervals).
135129
136130
::
137131
@@ -154,8 +148,7 @@ def tricontour(ax, *args, **kwargs):
154148
Use keyword args to control colors, linewidth, origin, cmap ... see
155149
below for more details.
156150
157-
``C = tricontour(...)`` returns a
158-
:class:`~matplotlib.contour.TriContourSet` object.
151+
`.tricontour(...)` returns a `~matplotlib.contour.TriContourSet` object.
159152
160153
Optional keyword arguments:
161154
@@ -226,7 +219,6 @@ def tricontour(ax, *args, **kwargs):
226219
Override axis units by specifying an instance of a
227220
:class:`matplotlib.units.ConversionInterface`.
228221
229-
230222
tricontour-only keyword arguments:
231223
232224
*linewidths*: [ *None* | number | tuple of numbers ]
@@ -254,14 +246,13 @@ def tricontour(ax, *args, **kwargs):
254246
*antialiased*: bool
255247
enable antialiasing
256248
257-
Note: tricontourf fills intervals that are closed at the top; that
258-
is, for boundaries *z1* and *z2*, the filled region is::
249+
Note: `.tricontourf` fills intervals that are closed at the top; that is,
250+
for boundaries *z1* and *z2*, the filled region is::
259251
260-
z1 < z <= z2
252+
z1 < Z <= z2
261253
262-
There is one exception: if the lowest boundary coincides with
263-
the minimum value of the *z* array, then that minimum value
264-
will be included in the lowest interval.
254+
except for the lowest interval, which is closed on both sides (i.e. it
255+
includes the lowest value).
265256
"""
266257
kwargs['filled'] = False
267258
return TriContourSet(ax, *args, **kwargs)

0 commit comments

Comments
 (0)