Reputation: 263
I have a 15x15 image of a grid of numbers which I have shown using imagesc. However, the axis goes up to 450 in both directions, when I only want it to go up to 15. I tried:
axis/30;
But that doesn't do anything? All I want to do is divide the x and y axes by 30!
Upvotes: 1
Views: 9687
Reputation: 7817
The problem is, I presume, that although your image shows 15 numbers along in each axes, the total size of your image in pixels is 450 x 450 - and this is what imagesc
is using.
So, what you really have is an image with 15 x 15 blocks of 30 x 30 pixels. You can set the axes ticks and labels manually using XTick
and XTickLabel
:
atick = 15:30:415; %assuming you want the ticks in the centre of each block
set(gca,'XTick',atick);
set(gca,'XTickLabel', 1:15);
set(gca,'YTick',atick);
set(gca,'YTickLabel', 1:15);
Upvotes: 2