查看matplotlib可用字体
from matplotlib.font_manager import FontManager
fonts = set(f.name for f in FontManager().ttflist)
print ('可用字体:')
for f in sorted(fonts):
print('\t' + f)
可用字体:
Abyssinica SIL
DejaVu Sans
DejaVu Sans Display
DejaVu Sans Mono
DejaVu Serif
DejaVu Serif Display
FreeMono
FreeSans
FreeSerif
Garuda
KacstArt
KacstBook
KacstDecorative
KacstDigital
KacstFarsi
KacstLetter
KacstNaskh
KacstOffice
KacstOne
KacstPen
KacstPoster
KacstQurn
KacstScreen
KacstTitle
KacstTitleL
Khmer OS
Khmer OS System
Kinnari
LKLUG
Laksaman
Liberation Mono
Liberation Sans
Liberation Sans Narrow
Liberation Serif
Lohit Punjabi
Loma
Microsoft YaHei
NanumBarunGothic
NanumGothic
NanumMyeongjo
Norasi
OpenSymbol
Padauk
Padauk Book
Phetsarath OT
Purisa
STIX
STIX Math
STIXGeneral
STIXIntegralsD
STIXIntegralsSm
STIXIntegralsUp
STIXIntegralsUpD
STIXIntegralsUpSm
STIXNonUnicode
STIXSizeFiveSym
STIXSizeFourSym
STIXSizeOneSym
STIXSizeThreeSym
STIXSizeTwoSym
STIXVariants
Saab
Sawasdee
Symbola
TakaoPGothic
Tibetan Machine Uni
Tlwg Mono
Tlwg Typewriter
Tlwg Typist
Tlwg Typo
Ubuntu
Ubuntu Condensed
Ubuntu Mono
Umpush
Waree
cmex10
cmmi10
cmr10
cmss10
cmsy10
cmtt10
mry_KacstQurn
设置字体
from pylab import mpl
mpl.rcParams['font.sans-serif'] = ['Microsoft YaHei'] # 指定默认字体,win使用SimHei
mpl.rcParams['axes.unicode_minus'] = False # 解决保存图像是负号'-'显示为方块的问题
参考文献:
http://blog.youkuaiyun.com/u010129448/article/details/65445713