Repository: matplotlib/matplotlib
File: lib/matplotlib/contour.py (Python)

Code before:

    *X* and *Y* must both be ordered monotonically.

    If not given, they are assumed to be integer indices, i.e.
    ``X = range(N)``, ``Y = range(M)``.

Z : (M, N) array-like
    The height values over which the contour is drawn.  Color-mapping is
    controlled by *cmap*, *norm*, *vmin*, and *vmax*.

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+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 *n=7* (using `~.ticker.MaxNLocator`
    with *nbins=8*), producing up to 9 "nice" contour boundaries. For
    logarithmic scales, `~matplotlib.ticker.LogLocator` is used instead.

Returns
-------
`~.contour.QuadContourSet`

Other Parameters
----------------
corner_mask : bool, default: :rc:`contour.corner_mask`
    Enable/disable corner masking, which only has an effect if *Z* is
    a masked array.  If ``False``, any quad touching a masked point is
    masked out.  If ``True``, only the triangular corners of quads
    nearest those points are always masked out, other triangular
    corners comprising three unmasked points are contoured as usual.

colors : :mpltype:`color` or list of :mpltype:`color`, optional
    The colors of the levels, i.e. the lines for `.contour` and the
    areas for `.contourf`.

    The sequence is cycled for the levels in ascending order. If the
    sequence is shorter than the number of levels, it's repeated.

    As a shortcut, a single color may be used in place of one-element lists, i.e.
    ``'red'`` instead of ``['red']`` to color all levels with the same color.

    .. versionchanged:: 3.10

Review comment (suggestion):
```suggestion
    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.
```
Let's make it user-facing by stating what the equivalent input to the default behavior is. Also we don't need to repeat the details as that is explained above.

Code after:

    *X* and *Y* must both be ordered monotonically.

    If not given, they are assumed to be integer indices, i.e.
    ``X = range(N)``, ``Y = range(M)``.

Z : (M, N) array-like
    The height values over which the contour is drawn.  Color-mapping is
    controlled by *cmap*, *norm*, *vmin*, and *vmax*.

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+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`

Other Parameters
----------------
corner_mask : bool, default: :rc:`contour.corner_mask`
    Enable/disable corner masking, which only has an effect if *Z* is
    a masked array.  If ``False``, any quad touching a masked point is
    masked out.  If ``True``, only the triangular corners of quads
    nearest those points are always masked out, other triangular
    corners comprising three unmasked points are contoured as usual.

colors : :mpltype:`color` or list of :mpltype:`color`, optional
    The colors of the levels, i.e. the lines for `.contour` and the
    areas for `.contourf`.

    The sequence is cycled for the levels in ascending order. If the
    sequence is shorter than the number of levels, it's repeated.

    As a shortcut, a single color may be used in place of one-element lists, i.e.
    ``'red'`` instead of ``['red']`` to color all levels with the same color.

    .. versionchanged:: 3.10
        Previously a single color had to be expressed as a string, but now any