@@ -135,16 +135,17 @@ def _contour_args(self, args, kwargs):
135
135
136
136
::
137
137
138
- %(func)s(..., Z, N )
138
+ %(func)s(..., Z, levels )
139
139
140
- contour up to *N+1* automatically chosen contour levels (*N* intervals).
140
+ contour up to *levels+1* automatically chosen contour levels (*levels*
141
+ intervals).
141
142
142
143
::
143
144
144
- %(func)s(..., Z, V )
145
+ %(func)s(..., Z, levels )
145
146
146
- draw contour %(type)s at the values specified in sequence *V *, which must be in
147
- increasing order.
147
+ draw contour %(type)s at the values specified in sequence *levels *, which must
148
+ be in increasing order.
148
149
149
150
::
150
151
@@ -153,68 +154,117 @@ def _contour_args(self, args, kwargs):
153
154
Use keyword arguments to control colors, linewidth, origin, cmap ... see below
154
155
for more details.
155
156
157
+ Parameters
158
+ ----------
159
+ triangulation : `.Triangulation`, optional
160
+ The unstructured triangular grid.
161
+
162
+ If specified, then *x*, *y*, *triangles*, and *mask* are not accepted.
163
+
164
+ x, y : array-like, optional
165
+ The coordinates of the values in *Z*.
166
+
167
+ triangles : int array-like of shape (ntri, 3), optional
168
+ For each triangle, the indices of the three points that make up the
169
+ triangle, ordered in an anticlockwise manner. If not specified, the
170
+ Delaunay triangulation is calculated.
171
+
172
+ mask : bool array-like of shape (ntri), optional
173
+ Which triangles are masked out.
174
+
175
+ Z : array-like(N, M)
176
+ The height values over which the contour is drawn.
177
+
178
+ levels : int or array-like, optional
179
+ Determines the number and positions of the contour lines / regions.
180
+
181
+ If an int *n*, use `~matplotlib.ticker.MaxNLocator`, which tries to
182
+ automatically choose no more than *n+1* "nice" contour levels between
183
+ *vmin* and *vmax*.
184
+
185
+ If array-like, draw contour lines at the specified levels. The values must
186
+ be in increasing order.
187
+
156
188
Returns
157
189
-------
158
190
`~matplotlib.tri.TriContourSet`
159
191
160
192
Other Parameters
161
193
----------------
162
- colors : [ *None* | str | (mpl_colors) ]
163
- If *None*, the colormap specified by cmap will be used .
194
+ colors : color string or sequence of colors, optional
195
+ The colors of the levels, i.e., the contour %(type)s .
164
196
165
- If a string, like 'r' or 'red', all levels will be plotted in this color.
197
+ The sequence is cycled for the levels in ascending order. If the sequence
198
+ is shorter than the number of levels, it's repeated.
166
199
167
- If a tuple of colors (string, float, rgb, etc), different levels will be
168
- plotted in different colors in the order specified.
200
+ As a shortcut, single color strings may be used in place of one-element
201
+ lists, i.e. ``'red'`` instead of ``['red']`` to color all levels with the
202
+ same color. This shortcut does only work for color strings, not for other
203
+ ways of specifying colors.
169
204
170
- alpha : float
171
- The alpha blending value
205
+ By default (value *None*), the colormap specified by *cmap* will be used.
172
206
173
- cmap : [ *None* | Colormap ]
174
- A cm :class:`~matplotlib.colors.Colormap` instance or *None*. If *cmap* is
175
- *None* and *colors* is *None*, a default Colormap is used.
207
+ alpha : float, optional
208
+ The alpha blending value, between 0 (transparent) and 1 (opaque).
176
209
177
- norm : [ *None* | Normalize ]
178
- A :class:`matplotlib.colors.Normalize` instance for scaling data values to
179
- colors. If *norm* is *None* and *colors* is *None*, the default linear
180
- scaling is used.
210
+ cmap : str or `.Colormap`, default: :rc:`image.cmap`
211
+ A `.Colormap` instance or registered colormap name. The colormap maps the
212
+ level values to colors.
181
213
182
- levels : [level0, level1, ..., leveln]
183
- A list of floating point numbers indicating the level curves to draw, in
184
- increasing order; e.g., to draw just the zero contour pass ``levels=[0]``
214
+ If both *colors* and *cmap* are given, an error is raised.
185
215
186
- origin : [ *None* | 'upper' | 'lower' | 'image' ]
187
- If *None*, the first value of *Z* will correspond to the lower left corner,
188
- location (0, 0). If 'image', the rc value for ``image.origin`` will be
189
- used.
216
+ norm : `~matplotlib.colors.Normalize`, optional
217
+ If a colormap is used, the `.Normalize` instance scales the level values to
218
+ the canonical colormap range [0, 1] for mapping to colors. If not given,
219
+ the default linear scaling is used.
190
220
191
- This keyword is not active if *X* and *Y* are specified in the call to
192
- contour.
221
+ origin : {*None*, 'upper', 'lower', 'image'}, default: None
222
+ Determines the orientation and exact position of *Z* by specifying the
223
+ position of ``Z[0, 0]``. This is only relevant, if *X*, *Y* are not given.
224
+
225
+ - *None*: ``Z[0, 0]`` is at X=0, Y=0 in the lower left corner.
226
+ - 'lower': ``Z[0, 0]`` is at X=0.5, Y=0.5 in the lower left corner.
227
+ - 'upper': ``Z[0, 0]`` is at X=N+0.5, Y=0.5 in the upper left corner.
228
+ - 'image': Use the value from :rc:`image.origin`.
193
229
194
- extent : [ *None* | (x0, x1, y0, y1) ]
195
- If *origin* is not *None*, then *extent* is interpreted as in
196
- :func:`matplotlib.pyplot.imshow`: it gives the outer pixel boundaries. In
197
- this case, the position of Z[0, 0] is the center of the pixel, not a
198
- corner. If *origin* is *None*, then (*x0*, *y0*) is the position of Z[0,
199
- 0], and (*x1*, *y1*) is the position of Z[-1, -1].
230
+ extent : (x0, x1, y0, y1), optional
231
+ If *origin* is not *None*, then *extent* is interpreted as in `.imshow`: it
232
+ gives the outer pixel boundaries. In this case, the position of Z[0, 0] is
233
+ the center of the pixel, not a corner. If *origin* is *None*, then
234
+ (*x0*, *y0*) is the position of Z[0, 0], and (*x1*, *y1*) is the position
235
+ of Z[-1, -1].
200
236
201
- This keyword is not active if *X* and *Y* are specified in the call to
237
+ This argument is ignored if *X* and *Y* are specified in the call to
202
238
contour.
203
239
204
- locator : [ *None* | ticker.Locator subclass ]
205
- If *locator* is None, the default :class:`~matplotlib.ticker.MaxNLocator`
206
- is used. The locator is used to determine the contour levels if they are
207
- not given explicitly via the *V* argument.
240
+ locator : ticker.Locator subclass, optional
241
+ The locator is used to determine the contour levels if they are not given
242
+ explicitly via *levels*.
243
+ Defaults to `~.ticker.MaxNLocator`.
244
+
245
+ extend : {'neither', 'both', 'min', 'max'}, default: 'neither'
246
+ Determines the ``%(func)s``-coloring of values that are outside the
247
+ *levels* range.
248
+
249
+ If 'neither', values outside the *levels* range are not colored. If 'min',
250
+ 'max' or 'both', color the values below, above or below and above the
251
+ *levels* range.
208
252
209
- extend : [ 'neither' | 'both' | 'min' | 'max' ]
210
- Unless this is 'neither', contour levels are automatically added to one or
211
- both ends of the range so that all data are included. These added ranges
212
- are then mapped to the special colormap values which default to the ends of
213
- the colormap range, but can be set via
214
- :meth:`matplotlib.colors.Colormap.set_under` and
215
- :meth:`matplotlib.colors.Colormap.set_over` methods.
253
+ Values below ``min(levels)`` and above ``max(levels)`` are mapped to the
254
+ under/over values of the `.Colormap`. Note, that most colormaps do not have
255
+ dedicated colors for these by default, so that the over and under values
256
+ are the edge values of the colormap. You may want to set these values
257
+ explicitly using `.Colormap.set_under` and `.Colormap.set_over`.
216
258
217
- xunits, yunits : [ *None* | registered units ]
259
+ .. note::
260
+
261
+ An existing `.TriContourSet` does not get notified if properties of its
262
+ colormap are changed. Therefore, an explicit call to
263
+ `.ContourSet.changed()` is needed after modifying the colormap. The
264
+ explicit call can be left out, if a colorbar is assigned to the
265
+ `.TriContourSet` because it internally calls `.ContourSet.changed()`.
266
+
267
+ xunits, yunits : registered units, optional
218
268
Override axis units by specifying an instance of a
219
269
:class:`matplotlib.units.ConversionInterface`.""" )
220
270
@@ -225,24 +275,24 @@ def tricontour(ax, *args, **kwargs):
225
275
"""
226
276
%(_tricontour_doc)s
227
277
228
- linewidths : [ *None* | number | tuple of numbers ]
229
- If *linewidths* is *None*, defaults to :rc:` lines.linewidth` .
278
+ linewidths : float or array-like, default: :rc:`contour.linewidth`
279
+ The line width of the contour lines.
230
280
231
281
If a number, all levels will be plotted with this linewidth.
232
282
233
- If a tuple, different levels will be plotted with different linewidths
234
- in the order specified
283
+ If a sequence, the levels in ascending order will be plotted with
284
+ the linewidths in the order specified.
235
285
236
- linestyles : [ *None* | 'solid' | 'dashed' | 'dashdot' | 'dotted' ]
237
- If *linestyles* is *None*, the 'solid' is used.
286
+ If None, this falls back to :rc:`lines.linewidth`.
287
+
288
+ linestyles : {*None*, 'solid', 'dashed', 'dashdot', 'dotted'}, optional
289
+ If *linestyles* is *None*, the default is 'solid' unless the lines are
290
+ monochrome. In that case, negative contours will take their linestyle
291
+ from :rc:`contour.negative_linestyle` setting.
238
292
239
293
*linestyles* can also be an iterable of the above strings specifying a
240
294
set of linestyles to be used. If this iterable is shorter than the
241
295
number of contour levels it will be repeated as necessary.
242
-
243
- If contour is using a monochrome colormap and the contour level is less
244
- than 0, then the linestyle specified in
245
- :rc:`contour.negative_linestyle` will be used.
246
296
"""
247
297
kwargs ['filled' ] = False
248
298
return TriContourSet (ax , * args , ** kwargs )
@@ -254,8 +304,8 @@ def tricontourf(ax, *args, **kwargs):
254
304
"""
255
305
%(_tricontour_doc)s
256
306
257
- antialiased : bool
258
- enable antialiasing
307
+ antialiased : bool, default True
308
+ Enable antialiasing, overriding the defaults.
259
309
260
310
Notes
261
311
-----
0 commit comments