老是碰到这个问题,老是记不住,在此记录一下。
转自最简单方式解决python matplotlib中文乱码问题
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签
plt.rcParams['axes.unicode_minus']=False #用来正常显示负号
plt.plot((1,2,3),(4,5,7))
plt.xlabel('横坐标')
plt.ylabel('纵坐标')
plt.show()
网友评论