matplotlib不能显示中文的解决方法

import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
font = FontProperties(fname=r"c:\windows\fonts\msyh.ttc", size=14) #这里告诉系统用的是微软雅黑的字体
……
plt.ylabel(u'GDP数量',fontproperties=font)  #作图的时候记得在中文上加u‘’,且后面加上,fontproperties=font

猜你喜欢

转载自blog.csdn.net/zllnau66/article/details/81670896