Par*_*jar 12 python matplotlib python-2.7
如何在matplotlib中获取字体系列(或字体名称)列表.
import matplotlib.font_manager
matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf')
Run Code Online (Sandbox Code Playgroud)
借助此代码,我只能获得字体目录.我怎么能得到字体名称列表
"世纪教科书L","Ubuntu"等
提前致谢.
fal*_*tru 19
Try following:
>>> 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', ...]
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
11121 次 |
最近记录: |