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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
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.
回答(1 个)
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 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!