2024-04-20 01:46:22 发布
网友
如何在matplotlib中获取字体系列(或字体名称)列表。
import matplotlib.font_manager matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf')
借助这段代码,我只能得到字体目录。 如何获取字体名列表
"Century Schoolbook L", "Ubuntu".... etc
提前谢谢。
尝试以下操作:
>>> import matplotlib.font_manager >>> [f.name for f in matplotlib.font_manager.fontManager.ttflist] ['cmb10', 'cmex10', 'STIXNonUnicode', 'STIXNonUnicode', 'STIXSizeThreeSym', 'STIXSizeTwoSym', 'cmtt10', 'STIXGeneral', 'STIXSizeThreeSym', 'STIXSizeFiveSym', 'STIXSizeOneSym', 'STIXGeneral', 'cmr10', 'STIXSizeTwoSym', ...] >>> [f.name for f in matplotlib.font_manager.fontManager.afmlist] ['Helvetica', 'ITC Zapf Chancery', 'Palatino', 'Utopia', 'Helvetica', 'Helvetica', 'ITC Bookman', 'Courier', 'Helvetica', 'Times', 'Courier', 'Helvetica', 'Utopia', 'New Century Schoolbook', ...]
尝试以下操作:
相关问题 更多 >
编程相关推荐