簡體   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