欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

matplotlib画图显示中文

程序员文章站 2024-01-19 15:13:10
...

下载字体

  1. 拷贝到anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/fonts/ttf
  2. ~/.matplotlib/fontlist-v310.json文件,追加配置
  3. 清空缓存~/matplotlib/tex.cache 目录
  4. 画图的时候使用代码:
font = {'family': 'SimHei', 'size': '20'}

plt.rc('font', **font)

matplotlib画图显示中文

     

参考https://www.jianshu.com/p/240ea3ae0dc9