`

pandas绘图中文乱码解决方案

阅读更多

      pandas绘图的时候中文会变成方块。解决方法就是选择支持中文的字体即可。

 

 

 

import matplotlib.font_manager as fm

# 解决中文字体问题
# mac字体路径:/System/Library/Fonts/
cn_font = fm.FontProperties(fname='/System/Library/Fonts/PingFang.ttc')
plt.legend(prop=cn_font)

 

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics