How to generate triangular heatmap using matlab?
43 ビュー (過去 30 日間)
古いコメントを表示

Any idea to generate using matlab?
The data I have is a table shown below:

How can I make the heatmap directly from above table without the need to make a matrix?
0 件のコメント
回答 (2 件)
KALYAN ACHARJYA
2020 年 4 月 6 日
編集済み: KALYAN ACHARJYA
2020 年 4 月 6 日
data=tril(randi(100,[15,15]));
imagesc(data);
colormap summer
colorbar
Plese DO modification and addition(labels) as per required
0 件のコメント
Frederick Vonberg
2020 年 6 月 19 日
編集済み: Frederick Vonberg
2020 年 6 月 20 日
One other alternative, if you want to retain some of the functionality associated with heatmap, is to replace replace all values above the diagonal with NaN and then set all NaNs to white. The result will (look like) a triangular heatmap.
data = randi(100, [15, 15]);
ii = ones(size(data));
idx = tril(ii);
data(~idx) = nan;
heatmap(data, 'MissingDataColor', 'w', 'GridVisible', 'off', 'MissingDataLabel', " ")
Granted you now have an issue with an empty "missing data" label on the colorbar. You may find it preferable to set 'ColorbarVisible' to 'off', but now you have the options provided by the heatmap function.
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!