How can one change the font for graphics to sans serif?

https://www.mathworks.com/matlabcentral/answers/49446-how-can-i-change-the-fontface-of-a-text-within-a-plot
shows
set(gca, 'FontName', 'Times New Roman')
changes the font face of text in graphics. Then how can one change it to Sans Serif? I have tried
set(gca, 'FontName', 'Sans Serif')
But this did not help.

 Réponse acceptée

Use listfonts to determine what fonts are available on your system.
I suspect the issue here is one of spelling. In my system, it would be 'SansSerif'
set(gca, 'FontName', 'SansSerif')

5 commentaires

Thank you. I checked https://www.mathworks.com/help/vision/ref/listtruetypefonts.html before posting but could not find San Serif.
alpedhuez
alpedhuez le 21 Août 2021
Modifié(e) : alpedhuez le 21 Août 2021
Yes it now says
get(gca,'fontname')
ans= 'SansSerif'
But the figures font does not change. Changes to "Arial" also does not work. Change to 'cmr10' makes a change. Maybe some fonts are missing. What can be done?
I restarted Matlab 2021a but still the same.
Perhaps this answer can help?
Thank you. Let me work on it.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Develop Apps Programmatically dans Centre d'aide et File Exchange

Produits

Version

R2021a

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by