Skip to content

Uptade fix number of levels with log contour#29137

Closed
ebarcelosf wants to merge 1 commit intomatplotlib:mainfrom
ebarcelosf:issue2
Closed

Uptade fix number of levels with log contour#29137
ebarcelosf wants to merge 1 commit intomatplotlib:mainfrom
ebarcelosf:issue2

Conversation

@ebarcelosf
Copy link
Copy Markdown

@ebarcelosf ebarcelosf commented Nov 13, 2024

PR summary

By passing an integer value in the levels argument to specify the maximum number of contour levels, the program didn't always respect this limit in practice.
Adjusts the behavior so that the number of contour levels is generated as requested, even when using a logarithmic scale.
Fix #27576

PR checklist

super().changed()

def _autolev(self, N):
def _autolev(self, N, *, using_default):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this extra argument is not necessary.

The only place where this is passed it is simply a N is not None (on the input side, but the effect is the same)

So even if the variable is useful, it can be computed internally.

However, even further, the difference between LogLocator() and LogLocator(numticks=N) when N is None is nothing, therefore you can just pass it as a kwarg.

Haven't fully thought through the last portion (adjustments if levels are still insufficient) and if there may need to be at least a if N is not None in there potentially, but not sure yet.

@dstansby
Copy link
Copy Markdown
Member

Thanks for the pull request - this has been fixed by #27576 now, so I'll close this.

@dstansby dstansby closed this Jul 13, 2025
@melissawm melissawm moved this from Waiting for author to Done in First Time Contributors Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

4 participants