从 Matlab 到 LateX 的字体类型

Font type from Matlab to LateX

我想将 plot/graph 从 Matlab 导出到 Latex。由于各种原因,我希望图表中的字体类型为 'Arial'。我得到以下信息:

如您所见,字体类型不同。一切都应该在 Arial 中,我使用了以下内容:

set(gca,'FontName','Arial');  
fontname = 'Arial';
set(0,'defaultaxesfontname',fontname);
set(0,'defaulttextfontname',fontname);

怎么了?还是导出图的时候需要修改?

如果你阅读了axes property documentation you will see the 'LabelFontSizeMultiplier' property,其定义为:

Scale factor for label font size, specified as a numeric value greater than 0. The axes applies this scale factor to the value of the FontSize property to determine the font size for the x-axis, y-axis, and z-axis labels.

将此应用于一个小示例:

axObj = axes;
x = 1:10;
plot(x, x, x, 2*x, 'Parent', axObj);
legend('Lab Spectrum', 'Model Spectrum');
xlabel('Frequency (Hz)');

axObj.FontName = 'Arial';
axObj.LabelFontSizeMultiplier = 1;

产量: