Axes tick labelling after using imagesc in Matlab
matlab, matlab-figure
Solution
Unfortunately you cannot do it directly but have to set custom tick labels like this:
X = magic(512); % just some test data
imagesc(X);
set(gca, 'XTick', [0:0.1:1]*512, 'XTickLabel', [0:0.1:1]*100) % 10 ticks
set(gca, 'YTick', [0:0.05:1]*512, 'YTickLabel', [0:0.05:1]) % 20 ticks
Adjust the spacing of the ticks to change the number of ticks accordingly.
Problem
I am trying to plot a 512*512 matrix with specified axes values. This is the code I am using but somehow the returned figure still shows the axes labelled as 512 * 512. ``` x = [0,1]; y = [0,100]; X = reshape(prob_to_1,512,512); colormap('hot'); figure; subplot(1,1,1); axis([0 1 0 100]); imagesc(X); ``` I want the final figure to be labelled between 0-1 on y-axes and between 0-100 on the x-axes. Any suggestions/ideas? Thanks!!