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

Skip to content

Commit d42a0a8

Browse files
authored
Merge pull request matplotlib#12897 from anntzer/contour-docs
Reword a bit the contour docs.
2 parents 66126d9 + b2600c9 commit d42a0a8

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
@@ -1755,15 +1752,14 @@ def _initialize_x_y(self, z):
17551752
- 'image': Use the value from :rc:`image.origin`.
17561753
17571754
extent : (x0, x1, y0, y1), optional
1758-
If *origin* is not *None*, then *extent* is interpreted as
1759-
in :func:`matplotlib.pyplot.imshow`: it gives the outer
1760-
pixel boundaries. In this case, the position of Z[0,0]
1761-
is the center of the pixel, not a corner. If *origin* is
1762-
*None*, then (*x0*, *y0*) is the position of Z[0,0], and
1763-
(*x1*, *y1*) is the position of Z[-1,-1].
1755+
If *origin* is not *None*, then *extent* is interpreted as in
1756+
`.imshow`: it gives the outer pixel boundaries. In this case, the
1757+
position of Z[0,0] is the center of the pixel, not a corner. If
1758+
*origin* is *None*, then (*x0*, *y0*) is the position of Z[0,0],
1759+
and (*x1*, *y1*) is the position of Z[-1,-1].
17641760
1765-
This keyword is not active if *X* and *Y* are specified in
1766-
the call to contour.
1761+
This argument is ignored if *X* and *Y* are specified in the call
1762+
to contour.
17671763
17681764
locator : ticker.Locator subclass, optional
17691765
The locator is used to determine the contour levels if they
@@ -1829,20 +1825,17 @@ def _initialize_x_y(self, z):
18291825
Hatching is supported in the PostScript, PDF, SVG and Agg
18301826
backends only.
18311827
1832-
18331828
Notes
18341829
-----
1835-
1. :func:`~matplotlib.pyplot.contourf` differs from the MATLAB
1836-
version in that it does not draw the polygon edges.
1837-
To draw edges, add line contours with
1838-
calls to :func:`~matplotlib.pyplot.contour`.
1830+
1. `.contourf` differs from the MATLAB version in that it does not draw
1831+
the polygon edges. To draw edges, add line contours with calls to
1832+
`.contour`.
18391833
1840-
2. contourf fills intervals that are closed at the top; that
1841-
is, for boundaries *z1* and *z2*, the filled region is::
1834+
2. `.contourf` fills intervals that are closed at the top; that is, for
1835+
boundaries *z1* and *z2*, the filled region is::
18421836
18431837
z1 < Z <= z2
18441838
1845-
There is one exception: if the lowest boundary coincides with
1846-
the minimum value of the *Z* array, then that minimum value
1847-
will be included in the lowest interval.
1839+
except for the lowest interval, which is closed on both sides (i.e.
1840+
it includes the lowest value).
18481841
"""

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)