fontproperties报错,是因为版本问题吗?
import matplotlib.pyplot as plt
import numpy as np
times=np.arange(2000,2020)
sales= [109, 150, 172, 260, 273, 333, 347, 393, 402, 446, 466, 481, 499,504, 513, 563, 815, 900, 930, 961]
plt.plot(times,sales,label="销量")
plt.legend(loc="upper left")
plt.xticks(range(2000,2020,2))
报错内容:
AttributeError: Unknown property fontproperties
尝试过rcParams,可行,但是数字的字体也会改变
①图例的中文设置为黑体,正常显示
②画出的图x轴为2000 2002 2004 ... 2020,目前得到的图只到2018,没有2020