FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

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

Repository navigation

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

Closed

Description

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

  1. timhoffm commented on Oct 7, 2022

    Member

    Thanks @martok. Do you want to make a pull request?

  2. jklymak commented on Oct 8, 2022

    Member

    I think we should check if the docs were right at some point in the past though. Its possible we accidentally changed behaviour sometime recently? I haven't had time to check...

  3. oscargus commented on Oct 8, 2022

    Member

    The doc-string came in #16534 where it was modified from

                If an int *n*, use *n* data intervals; i.e. draw *n+1* contour
                lines. The level heights are automatically chosen.
    

    so it may indeed be that vmin and vmax are guesses (although possibly educated ones).

  4. martok commented on Oct 8, 2022

    ContributorAuthor

    I think we should check if the docs were right at some point in the past though. Its possible we accidentally changed behaviour sometime recently? I haven't had time to check...

    And I've traced it back through blames all the way since it was introduced in 2004, _autolev or its predecessors have always done the same thing.
    But there was no cause for confusion before it gained norm support and later the vmin/max parameters in f5c85d8.

    so it may indeed be that vmin and vmax are guesses (although possibly educated ones).

    I mean, they're good guesses. Since vmin and vmax configure the norm they act as a kind of "implied zlim" for all other heatmap-style functions. Just not this one.

  5. timhoffm commented on Oct 9, 2022

    Member

    Closed by #24130

  6. added this to the v3.6.2 milestone on Oct 10, 2022
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


      Back | FazBrowse Home | New Git URL