change tick values heat map
10 ビュー (過去 30 日間)
古いコメントを表示
I want to set ticks to my heat map figure. I don't find any options to do it. It has automatically set it with numbers. also I want to add subscripts to the values inside the boxes.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1050785/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1050785/image.png)
0 件のコメント
採用された回答
Chunru
2022 年 7 月 1 日
It seems that "heatmap" has no properties for changing display text. You can use imagesc instead:
data = rand(4);
imagesc(data); colorbar
h = gca;
h.XTick= 1:4;
h.XTickLabel = ["A", "B", "C", "D"];
[xx, yy] = meshgrid(1:4, 1:4);
str = string(data(:));
str(1) = str(1)+"^B"; % Now you can specify the text anyway you like. This is an example
text(xx(:), yy(:), str, 'HorizontalAlignment', 'center')
4 件のコメント
その他の回答 (1 件)
Chunru
2022 年 6 月 30 日
cdata = rand(3,3);
h = heatmap(cdata);
h.XData = ["A", "B", "C"];
h.YData = ["A_1", "B_1", "C_1"];
3 件のコメント
参考
カテゴリ
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!