-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ListedColormap: don't pass N colors #9811
Conversation
That's actually also mentioned in #9810 (maybe because internal warnings now error?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should get us back the the previous behaviour. Maybe except for handling of gray values. mpl argues that lists of colors should not be duplicated/ truncated except for countour plots. I did not have the patience to go into that.
@@ -1806,7 +1806,6 @@ def test_colors_np_levels(self) -> None: | |||
cmap = artist.cmap | |||
assert isinstance(cmap, mpl.colors.ListedColormap) | |||
colors = cmap.colors | |||
assert isinstance(colors, list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's now an numpy array. I am reasonably sure that is a behaviour change in matplotlib and I don't think we should try to preserve that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the instance check was only there to make mypy happy. We don't really care what type colors is, as long as it is indexable.
remaining failures are unrelated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks.
Thanks for taking this on! |
whats-new.rst
api.rst
matplotlib/matplotlib#29135 deprecated passing
N
toListedColormap
. This PR avoids the deprecation warnings once the new matplotlib version is released.