matplotlib 显示中文 与 latex冲突

Posted on 2015-06-24 14:04  柳泉松声  阅读(561)  评论(0编辑  收藏  举报

如果在使用中文之前包含了使用latex的语法:

mpl.rcParams['text.usetex'] = True

将不能正确显示含有中文的图片。

 

附 显示中文的方法:

from matplotlib.font_manager import FontProperties
font_chinese = FontProperties(fname=r"c:\windows\fonts\simsun.ttc", size=12)

 

 title(u'比值', fontproperties=font_chinese)

Copyright © 2024 柳泉松声
Powered by .NET 8.0 on Kubernetes