Easy way to programmatically change all font types and sizes in all figures in MATLAB

百般思念 提交于 2019-12-11 04:49:57

问题


I am generating a number of plots in MATLAB. The axis labels and the tick labels are currently too small when included in my final document. I would like to change the font size for both axis labels and tick labels while also setting a new default typeface. I have tried the FontSize and FontName name value pair but strangely see no effect on the exported .eps files; also this method is somewhat impractical because I am generating a large number of plots.

Any suggestions would be greatly appreciated.


回答1:


You can use findobj to programmatically edit all figures. For example:

ah = findobj(,'Type','axes'); % get all axes
set(ah,'FontSize',Whatever); %this will change all the tick labels
for m=1:numel(ah) % go over all axes
  xlabel_handle = get(ah(m),'xlabel');
  set(xlabel_handle,'FontSize',Whatever); % this will change only the label
  %repeat for other labels if you wish
end


来源:https://stackoverflow.com/questions/29716854/easy-way-to-programmatically-change-all-font-types-and-sizes-in-all-figures-in-m

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!