MATLAB Answers

Why is "Helvetica" the default axes font type in MATLAB when this font does not exist on my Windows XP machine?

178 views (last 30 days)
When I create text on an axis of a figure in MATLAB, the font type of the text is "Helvetica" but this font does not exist on my machine.
plot(1:10)
xlabel('Text');
get(gca, 'FontName')
If I print this figure to an EPS-file, and use the figure in another application, I receive an error that the font is not found.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 Feb 2018
Edited: MathWorks Support Team on 7 Feb 2018
Axes text which use the default font type in MATLAB may not be visible when exporting MATLAB graphics to other applications, if the 'Helvetica' font is not available on the system.
To work around this issue, change the default font by executing the following command:
set(0,'defaultAxesFontName', '<fontname>')
set(0,'defaultTextFontName', '<fontname>')
where '<fontname>' is the name of the font you wish to use, e.g. 'Arial'.
You may include this statement in your startup.m file to ensure that it is executed in every MATLAB session. For more information on creating a startup.m file, execute the following command in the MATLAB Command Window:
doc startup
If you print a figure in MATLAB, the fonts supported for printing depend upon the MATLAB printer driver you specify and sometimes upon which platform you are using. For further information, refer to the following documentation on Font Support:
  2 Comments
Bryan
Bryan on 22 Nov 2019
I have the same problem. The fonts appear in the figure window but disappear when doing the following two things. (1) Saving using -painters (2) Using a special character with char()
Happens in Linux, but not in Windows

Sign in to comment.

More Answers (0)

Products


Release

R14SP1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!