MATLAB: Question about the axis of a figure

homework

On the x-axis I have 'number of subjects'. But the axis goes from 0 – 0.5 – 1 – 1.5 – … Since 1.5 subjects doesn't exist, I want to get rid of these number with the comma. How do I do this?

Best Answer

You need to set the specific 'XTick' locations.
Example:
figure(1)
subplot(2,1,1)
scatter(rand(10,1)*3, rand(10,1)*2, 'pb')
grid
subplot(2,1,2)
scatter(rand(10,1)*3, rand(10,1)*2, 'pb')
grid
xt = get(gca, 'XTick');
set(gca, 'XTick', floor(min(xt)):ceil(max(xt)))
To illustrate: