-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
imshow interpolation uses masked values #8012
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
Comments
Note that in carves out a larger area because the region of screen pixels that get input from the masked data values is larger. |
The fix seems to break something else, will get to this tomorrow. |
This is way nastier than I expected 😞 |
@tacaswell Doesn't this still require some tweaks (cf. the last comment in #8024 and #8183)? |
Yes, on my to-do list for tonight |
This seems still to be the case, would It be possible for interpolation to not change the size of the masked area? |
No, because the way the interpolation works is by (effectively) convolving the input data with a fixed size kernel. Any place you evaluate the kernel that overlaps with a masked point also needs to be poisoned (e.g. if you drop a |
Yes I understand. My problem is not that I have np.nan, but simply that I want to mask some voxels from the image being shown. One solution could be to add a mask option to imshow, then the interpolation could be done before masking. Or another option would be to detect if the data is masked, then remove the mask (perhaps also replace masked values with zero), do the interpolation and then reapply the mask. |
If you want the masked pixel to be transparent, you are stuck, if you want to make it white, you can do something like
|
Bug report
I recently upgraded to v2.0.0 and noticed that the new imshow interpolation is not honoring masked values. This is likely related to the new edge handling, described here: http://matplotlib.org/examples/pylab_examples/image_interp.html
Code for reproduction
Actual outcome
Expected outcome
The interpolation should ignore masked values as in previous versions.
Matplotlib version
The text was updated successfully, but these errors were encountered: