from matplotlib.font_manager import FontProperties
import matplotlib.pyplot as plt
font = FontProperties(fname=r"c:\windows\fonts\simsun.ttc", size=12)
plt.xlabel(u"X坐标", fontproperties=font)
plt.ylabel(u"Y坐标", fontproperties=font)
plt.title(u"XY关系图",fontproperties=font)
首先定义字体的位置,然后确定字体的型号
这样就可以显示中文了。