heatmap NaN Color replacement BUG
Mostrar comentarios más antiguos
Hi Community!
I am trying to grey out diagonals (for ease of viewing-0 being white was not sufficient for my collaborators) without modifying my color map to a custom color map, but am running across a curious issue; here is my code:
heatmap(a_y(1:2,2:3), MWx, MWy, ...
'%0.2f', 'TickAngle', 45, 'Colormap', redblue(100), 'FontSize', 25, 'NaNColor', [0.5 0.5 0.5])
title('Log 10 Relationships of Median Y_{1/2} MDA231 Note: (x/y)')
ax = gca;
ax.FontSize = 16;
ax.FontName = 'Arial';
clim([-0.10 0.10])
colorbar
This produces a heat map that looks incorrect, based on the color bar minimum and maximum value. In fact it treats clim as if it doesn't actually exist for the coloring of the heatmap, but does exist for the colorbar.

alternatively, if I use the code and remove the 'NanColor':
a_y = log10(PC3_y./trans_PC3_y);
a_y(sub2ind(size(a_y), 1:length(a_y), 1:length(a_y))) = NaN; %NaN on diagonals
figure
heatmap(a_y(1:2,2:3), MWx, MWy, ...
'%0.2f', 'TickAngle', 45, 'Colormap', redblue(100), 'FontSize', 25)
title('Log 10 Relationships of Median Y_{1/2} PC3 Note: (x/y)')
ax = gca;
ax.FontSize = 16;
ax.FontName = 'Arial';
clim([-0.10 0.10])
colorbar
I get a correct image, however NaN is considered the minimum value, which just makes a snap interpretation of this more difficult:

I even attempted to adjust the code of heatmap.m, where the code states:
p.addParamValue('NaNColor', [NaN NaN NaN], @(x)isnumeric(x) && length(x)==3 && all(x>=0) && all(x<=1)); %I adjusted [NaN NaN NaN] to 0.5 for all to make it grey
While it was successful in greying out the 1 diagonal in this abreviated heatmap, it messed up the heatmap's coloring just like the first image did. Does anyone know how to grey out without running into that problem?
Thanks,
Nick
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Distribution Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
