Skip to content

Avoid duplicate cmap in image options. #6346

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
Apr 28, 2016

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Apr 28, 2016

The previous implementation (#5469) was incorrect and would yield a double entry
in the cmap combobox.

The previous implementation was incorrect and would yield a double entry
in the cmap combobox.
@@ -137,7 +137,7 @@ def prepare_data(d, init):
for label in imagelabels:
image = imagedict[label]
cmap = image.get_cmap()
if cmap not in cm.cmap_d:
Copy link
Member

Choose a reason for hiding this comment

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

would it be better to check that cmap.name not in cm.cmap_d?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought someone could accidentally create a custom cmap with the same name as one in cmap_d (although it's a pretty theoretical risk and it'd make the combobox awkward anyways), so checking on cmap identity should be safer.

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Apr 28, 2016
@tacaswell
Copy link
Member

👍 on this.

RE my comment; I do not have an opinion one way or the other, just curious why you picked this implementation.

@tacaswell tacaswell merged commit 6b45409 into matplotlib:master Apr 28, 2016
@QuLogic QuLogic added the GUI: Qt label May 2, 2016
@QuLogic QuLogic modified the milestones: 2.0 (style change major release), 2.1 (next point release) Jul 10, 2016
@anntzer anntzer deleted the image-options-fix branch April 24, 2022 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants