how can i add the numers on the heatmap?

조회 수: 9 (최근 30일)
myrto pieridou
myrto pieridou 2022년 7월 8일
댓글: myrto pieridou 2022년 7월 18일
cdata=[1.6 1.6 1.6,1.6,1.6 1.6 1.6 1.6 1.1 1.1 1.1 1.3 1.3 1.3 4.5 1.6 1.6 1.6 1.6 1.6 1.6 1.6 2.3 2.3 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 5.6; %33
1.1 1.1 0.79 0.79 1.1 1.1 0.79 0.79 0.93 0.93 0.93 1.1 1.1 1.1 1.1 0.46 0.46 0.46 0.46 0.46 0.43 0.43 1.6 1.6 1.1 1.1 1.1 1.1 1.1 1.1 0.43 0.43 1.6; %32
1.1 1.1 0.79 0.79 1.1 1.1 0.79 0.79 0.93 0.93 0.93 1.1 1.1 1.1 1.1 0.46 0.46 0.46 0.46 0.46 0.43 0.43 1.6 1.6 1.1 1.1 1.1 1.1 1.1 1.1 0.43 0.43 1.6; %31
1.6 1.6 1.0 1.0 1.6 1.6 1.0 1.0 1.3 1.3 1.3 1.6 1.6 1.6 1.6 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.1 1.1 1.6; %30
1.6 1.6 1.0 1.0 1.6 1.6 1.0 1.0 1.3 1.3 1.3 1.6 1.6 1.6 1.6 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.1 1.1 1.6; %29
1.6 1.6 1.0 1.0 1.6 1.6 1.0 1.0 1.3 1.3 1.3 1.6 1.6 1.6 1.6 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.1 1.1 1.6; %28
1.6 1.6 1.0 1.0 1.6 1.6 1.0 1.0 1.3 1.3 1.3 1.6 1.6 1.6 1.6 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.1 1.1 1.6; %27
1.6 1.6 1.0 1.0 1.6 1.6 1.0 1.0 1.3 1.3 1.3 1.6 1.6 1.6 1.6 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.1 1.1 1.6; %26
1.6 1.6 1.0 1.0 1.6 1.6 1.0 1.0 1.3 1.3 1.3 1.6 1.6 1.6 1.6 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.6 1.1 1.1 1.6; %25
];
xvalues=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33];
yvalues=[1 2 3 4 5 6 7 8 9 ];
h=heatmap(xvalues,yvalues,cdata);
  댓글 수: 2
Adam Danz
Adam Danz 2022년 7월 8일
I edited your question to remove the screen shot and replace it with the figure generated by the "run feature". I also formatted your code.
This can all be achieved by using tools in the toolbar when editing your question.
myrto pieridou
myrto pieridou 2022년 7월 18일
Thank you soooo much!!!!!

댓글을 달려면 로그인하십시오.

답변 (1개)

Adam Danz
Adam Danz 2022년 7월 8일
편집: Adam Danz 2022년 7월 13일
The cell values in heatmap appear when the figure is large enough to fit them in. Increase your figure size or decrease the density of the heatmap to make space for the text labels.
You can programmatically maximize the figure using
set(gcf, 'WindowState', 'maximized')
Alternatively, you can create a heatmap look-alike using imagesc which is demo'd here. The text labels won't disappear in this workaround.

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by