Skip to content

Conversation

ebarcelosf
Copy link

@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

@@ -960,13 +960,12 @@ def changed(self):
label.set_color(self.labelMappable.to_rgba(cv))
super().changed()

def _autolev(self, N):
def _autolev(self, N, *, using_default):
Copy link
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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for author
Development

Successfully merging this pull request may close these issues.

3 participants