美文网首页
plt 画图 中文字体设置

plt 画图 中文字体设置

作者: simba0705 | 来源:发表于2016-12-23 16:38 被阅读241次

ubuntu 16.04  中文字体位置  

1 前提默认已安装中文字体     (桌面版)  

2  字体位置:

 /usr/share/fonts/opentype/noto/NotoSansCJK-Black.ttc

3   导入字体管理包 

from matplotlib.font_manager import FontProperties

zhfont1 = matplotlib.font_manager.FontProperties(fname='/usr/share/fonts/cjkunifonts-ukai/ukai.ttc')

4  画图时,引用中文字体

plt.xlabel(u'中文字体',fontproperties=zhfont1)

相关文章

网友评论

      本文标题:plt 画图 中文字体设置

      本文链接:https://www.haomeiwen.com/subject/uxbkvttx.html