首页 > 代码库 > matlab中boxplot字体大小设置

matlab中boxplot字体大小设置

网上找到的:
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

 

matlab中boxplot字体大小设置