gpt4 book ai didi

Matlab调整热图轴和颜色

转载 作者:行者123 更新时间:2023-12-02 08:23:58 30 4
gpt4 key购买 nike

我正在尝试创建一个我不太熟悉的热图。我有一个很大的矩阵:

One=
[0 2 4 6 8
2 1 3 5 6
4 5 8 3 1
6 2 7 4 8
8 3 9 5 4]

我想创建一个热图,其中最上面的行和最左边的列是轴。到目前为止,我已经做到了:

figure(1)
Plot = One;
colormap('hot');
imagesc(Plot);

我还注意到,在“热”颜色图中,小数字非常暗,大数字是白色。有办法扭转这种局面吗?

最佳答案

这是一个好的开始:

One = ...
[0 2 4 6 8
2 1 3 5 6
4 5 8 3 1
6 2 7 4 8
8 3 9 5 4];

figure();
imagesc(One(1,:), One(:,1), One(2:end,2:end));
get(gca(), 'ydir', 'normal')
colormap(flipud(hot()));
colorbar();

enter image description here

请注意 x 和 y 轴比数据大,因此可能需要排除 One(1,1):

figure();
imagesc(One(1,2:end), One(2:end,1), One(2:end,2:end));
get(gca(), 'ydir', 'normal')
colormap(flipud(hot()));
colorbar();

enter image description here

关于Matlab调整热图轴和颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34090871/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com