+1 for an interesting question.
Here is a way to do this, maybe not the most elegant, but shows the logic and does it:
x=0:pi/10:pi; plot(x,sin(x)); set(gca, 'XTick', x, 'XTickLabel', cell(numel(x),1)); yl=get(gca,'YLim'); for n=1:numel(x) if mod(n,2) text(x(n), yl(1), {num2str(x(n)),''},'HorizontalAlignment','Center','VerticalAlignment','Top'); else text(x(n), yl(1), {'',num2str(x(n))},'HorizontalAlignment','Center','VerticalAlignment','Top'); end end

Use various text properties to change the font size, text format, etc.
bla
source share