如何獲取 Matplotlib 當前可用所有字型的列表?
若要獲取 Matplotlib 當前可用所有字型的列表,我們可以使用font_manager.findSystemFonts() 方法。
步驟
列印一條語句。
使用 font_manager.findSystemFonts() 方法獲取可用字型的列表。
範例
from matplotlib import font_manager
print("List of all fonts currently available in the matplotlib:
")
print(*font_manager.findSystemFonts(fontpaths=None, fontext='ttf'), sep="
")輸出
/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
廣告
資料結構
網路
關係型資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP