import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['SimHei']plt.rcParams['axes.unicode_minus'] = False
代码中加入以上两行就可以了