I have 2D data that I am trying to display with imshow. Regions of the data are nan and marked as masked.
Because of things like anisotropy, I use bilinear interpolation and would like to keep doing so. Using is_bad I am pretty sure I am getting the masked values are being rendered the way I want them, but the nan color seems to bleed into the good part of the data causing a blur.
Is there a good way to sharpen up the interface between nan and non-nan data? Do I have to identify the border and draw a line over it or can I do this with imshow parameters?
Thanks!
Eli
Well, this is a bit of a convoluted solution, but I don’t know of a better one.
Just to demonstrate the problem you’re talking about to people who may not be familiar with it:
The blurring is because matplotlib interpolates alpha (transparency) values. Changing this would require low-level tweaking.
However, as long as you don’t need to show the layer beneath the image in the regions of no data, you can do something like this:
If we don’t plot the original data using the “filled” version (
data.filled(data.mean())), we’ll get “halos” around the blocked-out invalid values: