Reputation: 1686
I try to use the AvantGarde font in a MATLAB figure plot. However on the figure, the font is not displayed. I have the R2015a MATLAB version on Ubuntu.
When I use the *listfonts
command, the AvantGarde font is listed as available.
When using uisetfont
, the AvantGarde font is working and display without any problems. As shown here (uisetfont
command):
Here is an extraction of my code where i set up the font:
fontname = 'AvantGarde';
set(0,'DefaultAxesFontName',fontname,'DefaultTextFontName',fontname);
Here an extraction of my output where the problems occurs:
I don't understand where the problem comes from and why the choosen font is not used for my figure, any help would be appreciate
Upvotes: 2
Views: 3937
Reputation: 673
have you set the default font before you created the figure?
the following example works for me:
clear all;
fontname = 'AvantGarde';
set(0,'DefaultAxesFontName',fontname,'DefaultTextFontName',fontname);
figure;
plot(1:10,1:10);
xlabel('test x');
ylabel('test y');
As an Alternative, you can set the appropriate Property after creation of the figure, by storing the handle to the x- and y-label.
clear all;
fontname = 'AvantGarde';
% set(0,'DefaultAxesFontName',fontname,'DefaultTextFontName',fontname);
figure;
plot(1:10,1:10);
xLabelHandle = xlabel('test x');
yLabelHandle = ylabel('test y');
set(yLableHandle,'Fontname',fontname);
Upvotes: 3