1、下载simhei.ttf

python matplot画图支持中文

 

 2、放在python路径下

D:\Soft\Python3.8\Lib\site-packages\matplotlib\mpl-data\fonts\ttf

 

3、代码增加

import matplotlib as mpl

# 中文支持
mpl.rcParams['font.sans-serif'] = ['SimHei']    # 指定默认字体:解决plot不能显示中文问题
mpl.rcParams['axes.unicode_minus'] = False           # 解决保存图像是负号'-'显示为方块的问题

 

相关文章:

  • 2021-10-15
  • 2021-04-22
  • 2021-05-15
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
相关资源
相似解决方案