I can't get the correct figure font name
Mostra commenti meno recenti
I would like to use 'NewCenturySchoolBook' or 'Palatino' but the font does not change. Note that it does change for 'Times' or 'Palatino Linotype'. Am I missing something?
font = 'NewCenturySchoolBook';
figure('DefaultTextFontName',font,'DefaultAxesFontName',font);
plot(1:5,8:12)
legend('random stuff')
xlabel('also random')
ylabel('what is going on here')
6 Commenti
madhan ravi
il 28 Ago 2018
It does change for me.Increase the font size and see the difference because it's too small.
yvan becard
il 28 Ago 2018
madhan ravi
il 28 Ago 2018
Can you upload the picture for working and not working fonts?
madhan ravi
il 28 Ago 2018
If not only way is to report a bug to Mathworks support team.
yvan becard
il 28 Ago 2018
madhan ravi
il 28 Ago 2018
Just contact Mathworks team if you are not satisfied with the font.
Risposta accettata
Più risposte (1)
Image Analyst
il 28 Ago 2018
Since I didn't see 'DefaultTextFontName' or 'DefaultAxesFontName' as options listed in the help for the figure function, and not even when I did
properties(gcf);
I did this, which works:
listfonts
font = 'NewCenturySchoolBook';
hFig = figure('DefaultTextFontName',font, 'DefaultAxesFontName',font);
properties(hFig)
plot(1:5,8:12)
ax = gca
legend('random stuff')
fontSize = ax.FontSize;
caption = sprintf('The font is %s with size %f', ax.FontName, fontSize);
title(caption, 'FontSize', fontSize);
xlabel('X Axis', 'FontSize', fontSize)
ylabel('Y Axis', 'FontSize', fontSize)
uiwait(msgbox('Click OK to see the fonts Change', 'modal'));
ax.FontName = 'NewCenturySchoolBook'
ax.FontSize = 18; % Change font size to 18
fontSize = ax.FontSize;
caption = sprintf('The font is %s with size %f', ax.FontName, fontSize);
title(caption, 'FontSize', fontSize);
Basically I set the fonts for the axes, not the figure.
Categorie
Scopri di più su Introduction to Installation and Licensing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!