打印当前的所有字体:
from matplotlib.font_manager import FontManager
fm = FontManager()
mat_fonts = set(f.name for f in fm.ttflist)
print(mat_fonts)配置中文字体显示:
plt.rcParams['font.sans-serif'] = ['LXGW WenKai'] # 用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False # 负号问题如果还显示不出来,获得缓存文件夹,直接删除里面的内容:
import matplotlib
matplotlib.get_cachedir()