MATLAB-如何从nxn矩阵绘制热图? [英] MATLAB -- How does one plot a heatmap from nxn matrix?
本文介绍了MATLAB-如何从nxn矩阵绘制热图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个50x50的矩阵,其中一些数字的范围从0到1以上.如何使用色条显示此数据的热图?我正在寻找的是x
和y
值的范围从1
到50
和1
到50
的图,每个点(x
,y
)都给定与矩阵条目(x
,y
)上的数据大小相对应的颜色.有关此类热图的示例,请查看此有趣的xkcd帖子.
I have a 50x50 matrix with some numbers ranging from 0 to a bit over 1. How do I show a heatmap of this data with a colorbar? What I'm looking for is a plot where the x
and y
values range from 1
to 50
and 1
to 50
, with each point (x
, y
) given a color corresponding to the size of the data at the matrix entry (x
, y
). For an example of such a heatmap, check out this amusing xkcd post.
谢谢!
推荐答案
您如何看待该示例? 另请参见?
What do you think about this example? see also?
>> A = randi([10,60],100,100);
>> colormap('hot')
>> imagesc(A)
>> colorbar
这篇关于MATLAB-如何从nxn矩阵绘制热图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文