Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a list of all the fonts currently available for Matplotlib?

e.g. when I want to set font in

matplotlib.rc('font', **font) 

Thanks.

like image 973
nye17 Avatar asked Jan 06 '12 05:01

nye17


People also ask

What fonts are available in matplotlib?

Matplotlib can use font families installed on the user's computer, i.e. Helvetica, Times, etc. Font families can also be specified with generic-family aliases like ( {'cursive', 'fantasy', 'monospace', 'sans', 'sans serif', 'sans-serif', 'serif'} ).

Where are matplotlib fonts stored?

To map font names to font files, matplotlib has a dictionary (or json file) located in its cache directory. Note, this file is not always in the same place, but usually sits at the home directory.

Where is matplotlib font cache?

It may be located under ~/. matplotlib/fontList. cache or ~/. cache/matplotlib/fontList.


1 Answers

import matplotlib.font_manager matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf') 

Check this for other options.

like image 128
imsc Avatar answered Oct 05 '22 23:10

imsc