How to hide the value in heatmap?
19 次查看(过去 30 天)
显示 更早的评论
I need to hide the value in the heatmap if it is zero.
Any suggestion?
0 个评论
采纳的回答
Ameer Hamza
2020-4-7
You can ignore those values in heatmap by setting them to nan. For example,
M(M==0) = nan; % M is the name of your variable.
heatmap(M);
5 个评论
Ameer Hamza
2020-4-7
MATLAB does not support making individual labels invisible, but here is a workaround. You can set the text color to the same as the background color for boxes with 0 value. It that way, they will appear invisible.
M = rand(5);
M(M<0.5) = 0;
h = heatmap(M);
h.CellLabelColor = h.Colormap(1,:);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!