I have two matrices A and B of the same size. Each can contain NaNs at some places. I visualize some measure C for the difference between A and B in the following way:
C = (A - B) ./ ((A + B) ./ 2) ;
figure(1); clf;
imagesc(C); colorbar;
I'd like to change the current presentation in a way so that:
- If isnan(A(i,j)) and ~isnan(B(i,j)) ---> white in the color map
- If ~isnan(A(i,j)) and isnan(B(i,j)) ---> black in the color map
- If isnan(A(i,j)) and isnan(B(i,j)) ---> gray in the color map
- otherwise ---> color according to C(i,j) value [as is now]
The colors above don't really matter as long as it is distinguishable.
I see there are similar ideas (here, for example) but not exactly what I need... Any ideas?
Many thanks!!!
Perhaps there are better solutions out there but I can come out with one here. Essentially, I'm creating an RGB representation of the image to show it. So I picked a colormap with the number of colors I wanted at first. Then, from the data, convert them to index and use
in2rgb()
to get the RGB image. Then, I can get the bin size of each color and label the color bar appropriately.