www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/SpecifyxAxisTickValuesExample.m

    %% Specify _x_-Axis Tick Values and Labels
% Create a line plot. Display tick marks along the _x_-axis at the values
% 0, 5, and 10. Then specify a label for each tick mark.

x = linspace(0,10);
y = x.^2;
plot(x,y)
xticks([0 5 10])
xticklabels({'x = 0','x = 5','x = 10'})