美文网首页
ubuntu plt 中文乱码解决

ubuntu plt 中文乱码解决

作者: 五长生 | 来源:发表于2019-05-21 11:11 被阅读0次

    1、首先在命令行输入

      fc-list :lang=zh 
    

    2、选择一种支持中文的字体

    /usr/share/fonts/truetype/arphic/uming.ttc
    

    3、在代码中改变

    import matplotlib as  mpl
    zhfont = mpl.font_manager.FontProperties(fname='/usr/share/fonts/opentype/noto/NotoSansCJK-Light.ttc')
    plt.xlabel(u'年龄',fontproperties = zhfont)
    plt.ylabel(u'视力',fontproperties = zhfont)

    相关文章

      网友评论

          本文标题:ubuntu plt 中文乱码解决

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