Quo
Quo

Reputation: 61

Axes set-up with matlab imshow

I have two images (I1 and I2) that I want to plot through subplot as follows. For sake of simplicity I created two fake images with size 512x512 pixels.

I1 = randn(512);
I2 = randn(512);
% display 
f1 = figure();
axis on;
subplot(1,2,1), imshow(uint8(I1));
subplot(1,2,2), imshow(uint8(I2));

I want the Y axis to show just the following ticks: 0 100 200 300 400 500. Therefore exactly as the X axis, so that it is clear that the image size is also bigger than 500 pixels. How can I do it? Thanks a lot!

Upvotes: 0

Views: 1281

Answers (1)

Peter
Peter

Reputation: 26

You should move the axis on to the end of the script and specify the XTick and XTickLabel properties.

I1 = randn(512);
I2 = randn(512);
% display 
f1 = figure();

s1=subplot(1,2,1);
imshow(uint8(I1));
set(s1,'XTick',0:100:500);
set(s1,'XTickLabel',0:100:500);
axis on;

s2=subplot(1,2,2);
imshow(uint8(I2));
set(s2,'XTick',0:100:500);
set(s2,'XTickLabel',0:100:500);
axis on;

Upvotes: 1

Related Questions