Reputation: 257
I want to export a plot/graph from Matlab to Latex. For various reasons, I want the font type 'Arial' in my graph. I got the following:
As you can see, the font type is different. Everything should be in Arial and I used the following:
set(gca,'FontName','Arial');
fontname = 'Arial';
set(0,'defaultaxesfontname',fontname);
set(0,'defaulttextfontname',fontname);
What is wrong? Or do I have to amend it when I export the plot?
Upvotes: 0
Views: 645
Reputation: 12214
If you read the axes
property documentation you will see the 'LabelFontSizeMultiplier'
property, which is defined as:
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.
Applying this to a small example:
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;
Yields:
Upvotes: 1