How to hide the value in heatmap?
조회 수: 24 (최근 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,:);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/282502/image.png)
추가 답변 (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!