diff --git a/lib/matplotlib/contour.py b/lib/matplotlib/contour.py index dfc39ed664f9..0cf49514acc7 100644 --- a/lib/matplotlib/contour.py +++ b/lib/matplotlib/contour.py @@ -1486,13 +1486,19 @@ def _initialize_x_y(self, z): levels : int or array-like, optional Determines the number and positions of the contour lines / regions. - If an int *n*, use `~matplotlib.ticker.MaxNLocator`, which tries - to automatically choose no more than *n+1* "nice" contour levels - between minimum and maximum numeric values of *Z*. + If an int *n*, use `~matplotlib.ticker.MaxNLocator`, which tries to + automatically choose no more than *n+2* "nice" contour level boundaries + between the minimum and maximum numeric values of *Z*. These boundaries + define where lines are drawn (for `contour`) or where filled regions + are separated (for `contourf`). If array-like, draw contour lines at the specified levels. The values must be in increasing order. + If not specified, a reasonable default is automatically chosen. For + linear scales, this corresponds to *levels=7*. For logarithmic + scales, `~matplotlib.ticker.LogLocator` is used instead. + Returns ------- `~.contour.QuadContourSet`