網上找到的:
set(findobj(gca,'Type','text'),'FontSize',18)
boxplot() uses the default axes labeling for the Y axes, but for the X axes, it uses text() to put the labels in place and it does not grab the axes FontSize when it does so.
Note: it is likely that with an 18 point font that the labels will overlap the y=0 axes.
意思就是boxplot的y軸坐標字體用的是默認的,可以通過
set(gca, 'Fontsize', 14);
來修改
而x軸字體是通過text()放進去的,不能通過默認方法修改,可以通過修改Type=Text類型的字體來做到
set(findobj(gca,'Type','text'),'FontSize',18)
不過字體太大重疊了,用這個方法可以避免重疊
txt = findobj(gca,'Type','text'); set(txt(3:end),'VerticalAlignment', 'Middle');
參考地址:
http://www.mathworks.com/matlabcentral/answers/2461-boxplot-xtick-label-size