From: Matt on
Hi,

I've been plotting data from a matrix that includes some NaN's as an imagesc plot.

My minimum values are being plotted blue (maximums red) but it appears that the NaN's are also being plotted blue therefore I cannot differentiate which data is NaN and which is actual minimum data...

Is it possible to plot NaN's a different colour such as white?

I've tried modifying the colour map to do this but it only covers the defined data and not the NaN's.

Matt
From: Walter Roberson on
Matt wrote:

> I've been plotting data from a matrix that includes some NaN's as an
> imagesc plot.
> My minimum values are being plotted blue (maximums red) but it appears
> that the NaN's are also being plotted blue therefore I cannot
> differentiate which data is NaN and which is actual minimum data...
>
> Is it possible to plot NaN's a different colour such as white?
> I've tried modifying the colour map to do this but it only covers the
> defined data and not the NaN's.

The NaN's should not be plotted, thus leaving whatever colour is
underneath showing through. That colour might, for example, be the axes
colour.

The only way I know of to plot NaN's is not to -- that is, to substitute
another value in place of the NaN's with the colormap set to show that
value as desired. This may require manually scaling your data if you are
relying on Matlab to map the minimum data value to the first color and
the maximum data value to the last color.