ABC
ABC

Reputation: 123

Matlab: changing the axis

How can you rescale the range of the axis without changing what's on the plot itself? So I would like to keep the plot, but changing the values on the axis... Thanks for your help!

Upvotes: 0

Views: 114

Answers (1)

Luis Mendo
Luis Mendo

Reputation: 112679

In the specific case you mention in the comments: instead of using something like

imagesc(X)

use

x = linspace(0,1,size(X,1));
y = linspace(0,1,size(X,2));
imagesc(x,y,X)

This changes the axis scale, and the axis labels are set correspondingly.


In general, to change tick labels of axes, use

set(gca,'xtick',[10 20]) %// values where you want the labels placed
set(gca,'xticklabel',{'label1','label2'}) %// desired labels

Upvotes: 1

Related Questions