Skip to content

MNT: Refactor matplotlib.colors.from_levels_and_colors() #29127

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

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Nov 12, 2024

Primary motivation was to remove the N parameter to ListedColormap (in preparation of its deprecation
#28763 (comment)).
That parameter is not needed here because
len(colors[color_slice]) == n_data_colors), otherwise the ValueError above would have raised.

Hopefully, this is overall more readable.

Primary motivation was to remove the N parameter to ListedColormap (in
preparation of its deprecation
matplotlib#28763 (comment)
-2322791660).
That parameter is not needed here because
`len(colors[color_slice]) == n_data_colors)`, otherwise the ValueError
above would have raised.

Hopefully, this is overall more readable.
@QuLogic QuLogic added this to the v3.11.0 milestone Nov 13, 2024
@QuLogic QuLogic merged commit 6af9a45 into matplotlib:main Nov 13, 2024
38 of 43 checks passed
@timhoffm timhoffm deleted the mnt-numcolors branch November 13, 2024 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants