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

MatplotlibServer Side ProgrammingProgramming

To get a list of all the fonts currently available for matplotlib, we can use the font_manager.findSystemFonts() method.

Steps

  • Print a statement.

  • Use font_manager.findSystemFonts() method to get a list of fonts availabe.

Example

from matplotlib import font_manager

print("List of all fonts currently available in the matplotlib:\n")
print(*font_manager.findSystemFonts(fontpaths=None, fontext='ttf'), sep="\n")

Output

/usr/share/fonts/truetype/Nakula/nakula.ttf
/usr/share/fonts/truetype/ubuntu/Ubuntu-L.ttf
/usr/share/fonts/truetype/tlwg/Loma-BoldOblique.ttf
.................................................................
............................................................................
.................................................................................
........
/usr/share/fonts/truetype/lohit-malayalam/Lohit-Malayalam.ttf
/usr/share/fonts/truetype/tlwg/TlwgTypist-Oblique.ttf
/usr/share/fonts/truetype/liberation2/LiberationMono-Bold.ttf
raja
Updated on 06-May-2021 13:37:23

Advertisements