8000 Fix linear segmented colormap with one element by timhoffm · Pull Request #14241 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix linear segmented colormap with one element #14241

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
May 18, 2019

Conversation

timhoffm
Copy link
Member

PR Summary

Fixes #14232.

Bug was introduced via #13097 where https://github.com/matplotlib/matplotlib/pull/13097/files#diff-1417350fe654c637d773bb4eac12b8f0 will make at least a 2-element list even for N=1.

The fix special-casese N=1 instead of reverting. I think it's cleaner that way. In particular also because the chosen value for N=1 is an arbitrary choice and we can make that obvious in the special-casing. The choice (color at x=1) is compatible with the former behavior.

@timhoffm timhoffm added this to the v3.1.1 milestone May 18, 2019
@@ -665,6 +669,7 @@ def __init__(self, name, segmentdata, N=256, gamma=1.0):

def _init(self):
self._lut = np.ones((self.N + 3, 4), float)
print(self._lut[:-3, 0].shape)
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

@timhoffm timhoffm force-pushed the fix-makeMappingArray branch from 9d5f49a to 9999fca Compare May 18, 2019 14:49
@timhoffm timhoffm force-pushed the fix-makeMappingArray branch from 9999fca to 89823a5 Compare May 18, 2019 15:15
@anntzer anntzer merged commit 40791c9 into matplotlib:master May 18, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request May 18, 2019
@timhoffm timhoffm deleted the fix-makeMappingArray branch May 18, 2019 16:25
timhoffm added a commit that referenced this pull request May 18, 2019
…241-on-v3.1.x

Backport PR #14241 on branch v3.1.x (Fix linear segmented colormap with one element)
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.

LinearSegmentedColormap with N=1 gives confusing error message
3 participants
0