Skip to content

Commit 44c1dd4

Browse files
committed
Doc: Clarify default levels behavior in contour/contourf
Explicitly state that the default levels corresponds to n=7 and clarifies that int input targets n+1 levels but may produce n+2.
1 parent ec3e68d commit 44c1dd4

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

lib/matplotlib/contour.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,13 +1485,17 @@ def _initialize_x_y(self, z):
14851485
14861486
levels : int or array-like, optional
14871487
Determines the number and positions of the contour lines / regions.
1488-
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*.
1492-
1488+
1489+
If an int *n*, use `~matplotlib.ticker.MaxNLocator` to automatically
1490+
choose approximately *n+1* "nice" contour levels between the minimum
1491+
and maximum values of *Z*. Note that the actual number may be up to
1492+
*n+2* depending on the data range.
1493+
14931494
If array-like, draw contour lines at the specified levels.
14941495
The values must be in increasing order.
1496+
1497+
If not specified, behaves as if ``levels=7`` was passed, typically
1498+
producing approximately 8 contour levels.
14951499
14961500
Returns
14971501
-------

0 commit comments

Comments
 (0)