is it possible to mark significance levels using heatmap?
Show older comments
I have a matrix with my data and a matrix with pvalues, is it possible to overlay pvalues under a specified threshold (i.e. .05) onto the heatmap, using a symble (e.g. *), or even the text value.
Accepted Answer
More Answers (1)
As far as I know, there is no built-in option to conditionally alter the heatmap data labels, but what you can do is create a heatmap with no data labels and create an additional invisible axes on top containing text objects that you can manipulate at will.
Example:
data = 100*rand(5)
p = 0.5*rand(5)
h = heatmap(data,'CellLabelColor','none');
str = compose('%0.4g\np=%0.2g',data(:),p(:));
idx = p(:) < 0.05;
str(idx) = strcat(str(idx),'*');
ax = axes( ...
'Visible','off', ...
'Units',h.Units, ...
'Position',h.Position, ...
'YDir','reverse');
[x,y] = meshgrid(categorical(h.XData),categorical(h.YData));
text(ax,x(:),y(:),str,'HorizontalAlignment','center')
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
