x = 1:12;
y = 10*rand(1,length(x));
h = plot(x,y,'+');
% Remove the default labels
set(gca,'XTickLabel','')
% 設定X軸刻度的位置,以使其與標定的月份對應
Xt = 1:1:12;
Xl = [1 12];
set(gca,'XTick',Xt,'XLim',Xl);
% 加入文本標籤
months = {'Jan';'Feb';'Mar';'Apr';'May';'Jun';'Jul';'Aug';'Sep';'Oct';'Nov';'Dec'};
Yl = ylim;
t = text(Xt,Yl(1)*ones(1,length(Xt)),months(1:1:12));
set(t,'HorizontalAlignment','right','VerticalAlignment','top', 'Rotation',45);