【问题标题】:Re-scaling X axis in imagesc plot in Matlab在 Matlab 中的 imagesc 图中重新缩放 X 轴
【发布时间】:2018-02-11 00:03:07
【问题描述】:

我在 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

【问题讨论】:

    标签: matlab matlab-figure


    【解决方案1】:

    但是,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
    

    输出是:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-10-05
      • 1970-01-01
      • 2011-12-16
      • 2014-01-27
      • 2018-02-05
      • 1970-01-01
      • 2012-12-08
      • 1970-01-01
      相关资源
      最近更新 更多