Matplotlib Times New Roman 字体设置
matplotlib设置字体报错:
findfont: Font family ['Times New Roman'] not found. Falling back to DejaVu Sans.
解决方案:
https://zhuanlan.zhihu.com/p/509574840
上传字体文件到/usr/share/fonts
文件夹:
mkdir /usr/share/fonts
mv *.TTF /usr/share/fonts
删除matplotlib缓存:
rm ~/.cache/matplotlib/ -rf
matplotlib字体设置代码:
plt.rc('font',family='Times New Roman', size=15)