一般系统自带wqy-microhei,其ttc文件位于/usr/share/fonts/truetype/wqy/wqy-microhei.ttc

2. 将ttc文件复制到python文件目录

sudo cp /usr/share/fonts/truetype/wqy/wqy-microhei.ttc ./

 3. 在python文件中加上

 

# -*- coding: utf-8 -*-

import os.path
from matplotlib.font_manager import FontProperties
zh_font = FontProperties(fname=os.path.abspath('wqy-microhei.ttc'))
import matplotlib.pyplot as plt
plt.title(u'中文', fontproperties=zh_font)

 

 参考:http://andresabino.com/2015/08/18/fonts-and-matplotlib/

 

相关文章:

  • 2021-11-11
  • 2022-12-23
  • 2021-08-29
  • 2021-10-04
  • 2021-08-19
  • 2022-12-23
  • 2021-07-20
  • 2021-10-11
猜你喜欢
  • 2021-10-12
  • 2022-12-23
  • 2021-12-23
  • 2021-10-10
  • 2021-10-15
  • 2021-10-30
  • 2022-02-14
相关资源
相似解决方案