在MATLAB中以编程方式更改所有图形中所有字体类型和大小的简便方法 [英] Easy way to programmatically change all font types and sizes in all figures in MATLAB
问题描述
我正在MATLAB中生成许多图.当包含在我的最终文档中时,轴标签和刻度标签当前太小.我想更改轴标签和刻度标签的字体大小,同时还要设置新的默认字体.我尝试了FontSize
和FontName
名称值对,但是奇怪的是,对导出的.eps文件没有任何影响.同样,这种方法在某种程度上是不切实际的,因为我正在生成大量图.
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.
任何建议将不胜感激.
推荐答案
您可以使用findobj
以编程方式编辑所有图形.
例如:
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
这篇关于在MATLAB中以编程方式更改所有图形中所有字体类型和大小的简便方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!