繁体   English   中英

在Matlab中的imagesc图中重新缩放X轴

[英]Re-scaling X axis in imagesc plot in Matlab

我已经在Matlab中编写了以下代码,以显示红色的不同阴影。 如何将子图中的所有x轴重新缩放为0-1?

% create a custome color map
map = zeros(11,3);
reds = 0:0.1:1;
map(:,1) = reds(:);
colormap(map);

figure(1)

depth = [1 2 3 4];
num_depth = length(depth);

for index = 1: num_depth    
    subplot(num_depth,1,index);
    step = 1/(2^depth(index)-1);
    A = 0:step:1;
    imagesc(A);
    axis equal
    set(gca,'ytick',[])
end

在此处输入图片说明

但是, imagesc(x,y,C)可以指定图像位置。 使用xy指定对应于C(1,1)C(m,n)的角的位置。

% create a custome color map
map = zeros(11,3);
reds = 0:0.1:1;
map(:,1) = reds(:);
colormap(map);

figure(1)

depth = [1 2 3 4];
num_depth = length(depth);

for index = 1: num_depth    
    subplot(num_depth,1,index);
    step = 1/(2^depth(index)-1);
    A = 0:step:1;
    imagesc(0:1,0:1,A)
    axis([0 1 0 1])
    set(gca,'ytick',[])
end

输出为:

在此处输入图片说明

暂无
暂无

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

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