plt.bar(range(len(dic1)), list(dic1.values()), color='#4682B4', width=0.4) plt.bar([i + 0.4 for i in range(len(dic2))], list(dic2.values()), color='#D2691E', width=0.4) plt.legend() plt.show() if __name__ == "__main__": outbound_filename = "outbound.xlsx" initinv_filename = "init_inventory.xlsx" plan = Plan(outbound_filename, initinv_filename) price = plan.price dict_code2name = plan.code_name monthly_demand_all = plan.get_monthly_demand()[0] isInt = plan.isInt sS_record = dict() ori = OriginalPlan(outbound_filename, initinv_filename) for code, monthly_demand in monthly_demand_all.items(): kde = KDE(code, monthly_demand) # print(code, ori.get_service_level(code, kde.pdf)) # fig, ax = plt.subplots(2) # print(dict_code2name[code]+":") # pdf = kde.pdf # x_p = np.linspace(np.min(kde.demand), np.max(kde.demand), 300) # y_p = [pdf.subs(x, x_i) for x_i in x_p] # ax[0].plot(x_p, y_p) # kde.plot() # print(kde.estimate.score(kde.demand))