I have written the following code in Matlab to show different shades of color red. How can I re-scale all x-axis in sub-plots to 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
However, imagesc(x,y,C)
could specifies the image location. Use x
and y
to specify the locations of the corners corresponding to C(1,1)
and 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
the output is: