Skip to content

Commit 51fbfc4

Browse files
authored
Merge pull request matplotlib#31016 from sanrishi/fix-contour-levels-doc
Doc: Clarify default levels behavior in contour/contourf
2 parents e046a98 + 5ff02f0 commit 51fbfc4

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

lib/matplotlib/contour.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,16 +1486,22 @@ def _initialize_x_y(self, z):
14861486
levels : int or array-like, optional
14871487
Determines the number and positions of the contour lines / regions.
14881488
1489-
If an int *n*, use `~matplotlib.ticker.MaxNLocator`, which tries
1490-
to automatically choose no more than *n+1* "nice" contour levels
1491-
between minimum and maximum numeric values of *Z*.
1489+
If an int *n*, use `~matplotlib.ticker.MaxNLocator`, which tries to
1490+
automatically choose no more than *n+2* "nice" contour level boundaries
1491+
between the minimum and maximum numeric values of *Z*. These boundaries
1492+
define where lines are drawn (for `contour`) or where filled regions
1493+
are separated (for `contourf`).
14921494
14931495
If not given, a reasonable default is chosen; for linear scales,
14941496
*n*=7 is the default.
14951497
14961498
If array-like, draw contour lines at the specified levels.
14971499
The values must be in increasing order.
14981500
1501+
If not specified, a reasonable default is automatically chosen. For
1502+
linear scales, this corresponds to *levels=7*. For logarithmic
1503+
scales, `~matplotlib.ticker.LogLocator` is used instead.
1504+
14991505
Returns
15001506
-------
15011507
`~.contour.QuadContourSet`

0 commit comments

Comments
 (0)