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!