繁体   English   中英

在Matlab中生成灰度热图

[英]Generate Gray Scale Heat Map in Matlab

我有一个包含十进制值的大矩阵。 我想在Matlab中绘制出灰度热图。

我怎样才能做到这一点?

我尝试使用rgb2gray函数,但为此我需要先创建一个图像。 怎么能在matlab中完成?

imagesc将完成这项工作。

imagesc(img)
axis equal off
colormap gray
colorbar

你可以使用surf -plot

你的矩阵:

A = rand(50,50);

从上面看的情节:

surf(A);
view(0,90)

所需的灰度:

colormap(gray)

和colorbar作为图例:

colorbar

导致: 在此输入图像描述

示例代码:

myImage = mat2gray(myMatrix); % Converts your data to an image.
figure; hold on; % Creates a figure
imshow(myImage); % Show image
colormap(jet); % Sets the color map you want
colorbar; % Show a color bar on the right

您可能感兴趣的一些颜色贴图:

喷射 喷射

热

我认为jet代表heatmap

更多信息可以在Mathworks色彩页面找到。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM