How to hide the value in heatmap?

19 ビュー (過去 30 日間)
Zeynab Mousavikhamene
Zeynab Mousavikhamene 2020 年 4 月 6 日
I need to hide the value in the heatmap if it is zero.
Any suggestion?

採用された回答

Ameer Hamza
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
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,:);
Zeynab Mousavikhamene
Zeynab Mousavikhamene 2020 年 4 月 7 日
Thank you for your suggestion. I found a better way:
'MissingDataColor','1.00,1.00,1.00
Adding above code makes thos black circles white with no dat shown for NANs.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by