Skip to content

Fix ScalarFormatter formatting of masked values #15140

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 2 commits into from
Aug 28, 2019

Conversation

dstansby
Copy link
Member

Fixes #15103. Could probably do with a test. Possibly an API change since previously a masked value would be formatted as nan?

@dstansby dstansby added this to the v3.1.2 milestone Aug 27, 2019
@ImportanceOfBeingErnest
Copy link
Member

I think the case where the array itself contains nans should also not throw a warning.

import numpy as np
import matplotlib.pyplot as plt

A = np.random.rand(4, 4)
A[:2] = np.nan

fig, ax = plt.subplots(1, 1)
im = ax.imshow(A)
fig.colorbar(im)

@ImportanceOfBeingErnest
Copy link
Member

I don't think an API change note is needed. This simply fixes the bug introduced in #12459.
In 3.0.3 the outcome was [] as well.

@tacaswell tacaswell merged commit 8ed7c78 into matplotlib:master Aug 28, 2019
@lumberbot-app
Copy link

lumberbot-app bot commented Aug 28, 2019

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v3.1.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 8ed7c78725f948cf99ef65df53d4b9b23fc39d6a
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #15140: Fix ScalarFormatter formatting of masked values'
  1. Push to a named branch :
git push YOURFORK v3.1.x:auto-backport-of-pr-15140-on-v3.1.x
  1. Create a PR against branch v3.1.x, I would have named this PR:

"Backport PR #15140 on branch v3.1.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

@dstansby dstansby deleted the mask-fmt branch September 4, 2019 17:57
dstansby pushed a commit to dstansby/matplotlib that referenced this pull request Sep 4, 2019
FIX: ScalarFormatter formatting of masked values
tacaswell added a commit that referenced this pull request Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Colorbar for imshow messes interactive cursor with masked data
4 participants