[Doc]: Contour functions: auto-generated levels · Issue #24121 · matplotlib/matplotlib · GitHub
Skip to content

[Doc]: Contour functions: auto-generated levels #24121

Description

@martok

Documentation Link

https://matplotlib.org/devdocs/api/_as_gen/matplotlib.axes.Axes.contourf.html
https://matplotlib.org/devdocs/api/_as_gen/matplotlib.axes.Axes.tricontourf.html

Problem

This applies to tricontour/f and contour/f.

The documentation of the contour functions' levels parameter states:

            If an int *n*, use `~matplotlib.ticker.MaxNLocator`, which tries
            to automatically choose no more than *n+1* "nice" contour levels
            between *vmin* and *vmax*.

This is not true, the levels are always chosen betwen Z.min() and Z.max(). There is no way for the user to influence this when using the integer parameter variant. See implementation in contour.py: ContourSet._autolev().
Especially deceptive because the text as written is very much what one would expect, but that functionality does not exist (and never has).

Suggested improvement

Change "between vmin and vmax" to something like "in the data range" or more explicit "between minimum and maximum values of Z"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions