matplotlib 显示中文 与 latex冲突

时间:2023-03-09 01:35:22
matplotlib 显示中文 与 latex冲突

如果在使用中文之前包含了使用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)