Ubuntu Matplotlib 显示中文


查找中文字体

find /usr/share/fonts/ -name "*.ttc"

设置Matplotlib字体

from matplotlib.font_manager import FontProperties

font = FontProperties(fname=r"/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc") # 从上面随便选一个
plt.title("标题", fontproperties=font)
plt.xlabel("x轴标签", fontproperties=font)
plt.ylabel("y轴标签", fontproperties=font)
plt.show()


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM