Matplotlib保存无花果错误:TypeError:预期为整数参数,得到浮点数

时间:2018-06-26 09:43:01

标签: python matplotlib

我试图在总体数据集上创建可视化文件,并且在保存创建的可视化文件时遇到了此问题。以下是我编写的代码。

plt.figure(figsize = (50, 25))
for cl in country_list:
    yearly_population = []
    for yr in year_list:
        yearly_population.append(db[yr][db['Country'] == cl].sum())
    plt.plot(yearly_population, label = cl)
plt.xticks(np.arange(55), tuple(year_list), rotation = 60)
plt.legend(bbox_to_anchor = (0., 1.02, 1., .102), loc = 3, ncol = 8, 
mode = "expand", borderaxespad = 0.)
plt.show()
plt.savefig('population.jpg')

我收到以下错误:

TypeError: integer argument expected, got float

0 个答案:

没有答案