常用字体:
黑体 SimHei 微软雅黑 Microsoft YaHei
微软正黑体 Microsoft JhengHei 新宋体 NSimSun
新细明体 PMingLiU 细明体 MingLiU
标楷体 DFKai-SB 仿宋 FangSong
楷体 KaiTi 仿宋_GB2312 FangSong_GB2312
楷体_GB2312 KaiTi_GB2312
----------------------------------------------------------------------------
在matplotlib中使用ttf字体文件
from pathlib import Path
import matplotlib as mpl
from matplotlib import font_manager as fm
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
fpath = Path(mpl.get_data_path(), “fonts/ttf/cmr10.ttf”)
prop = fm.FontProperties(fname=fpath)
ax.set_title(f’This is a special font: {fpath.name}', fontproperties=prop)
ax.set_xlabel(‘This is the default font’)
plt.show()