Renumber an axis of a figure

4 views (last 30 days)
Zhiyong
Zhiyong on 31 May 2012
I am plotting a figure in which the adjacent elements of the x-axis are 1.224 meters apart. The x-label of the plotted figure will give an impression that the elements are 1 meter apart.
How do I change the numbers on the x-axis to reflect this?

Accepted Answer

Geoff
Geoff on 1 Jun 2012
You can replace the 'XTick' member of the axis. Here, I just use the handle to the current axis.
x = 0:1.224:10;
y = rand(1,numel(x));
plot(x,y,'.-');
set(gca, 'XTick', x);

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!