您的位置:首页 > 编程语言 > PHP开发

matplotlib图标中文显示

2017-04-21 17:25 295 查看
设置有fontproperties属性的,还有prop属性的

1,找到系统已安装的字体

2,

from matplotlib.font_manager import FontProperties

#fname=r"(本地中文字体的路径位置)",size=设置字体大小

font = FontProperties(fname=r"C:\\Windows\\Fonts\\STKAITI.TTF", size=14)


3,

plt.xlabel('性别', fontproperties=font)


plt.ylabel('人数', fontproperties=font)

或则没有fontproperties属性的

plt.legend((rect,), ('图例',), prop=font)


然后设置的这些都可以正常的显示了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  字体 python matplotlib