MATLAB: Manipulating X-Axis Values

axisplot

I made a line plot of a 30×1 matrix. Of course the values on the x-axis are 1-30 but I need to add 1970 to each of those because the axis is supposed to represent a year. Is there a way to add 1970 to each of the x-axis values? Thanks in advance.

Best Answer

One approach:
x = ...;
y = ...;
figure(1)
plot(x, y)
grid
xt = get(gca, 'XTick');
xtl = linspace(1970, 2000, numel(xt));
set(gca, 'XTick',xt, 'XTickLabel',xtl)