import matplotlib.pyplot as plt

客户规模

customer_sizes = [300, 350, 400, 450, 500, 550, 600]

分区数量

partitions = [6, 7, 8]

平均配送成本

average_costs = [[10, 20, 30, 40, 50, 60, 70], [15, 25, 35, 45, 55, 65, 75], [20, 30, 40, 50, 60, 70, 80]]

设置字体为Times New Roman

plt.rcParams["font.family"] = "Times New Roman"

绘制折线图

for i in range(len(partitions)): plt.plot(customer_sizes, average_costs[i], label="P=" + str(partitions[i]), linestyle='-', marker='o')

设置图例

plt.legend()

设置标题和坐标轴标签

plt.title("Average Delivery Cost") plt.xlabel("Customer Size") plt.ylabel("Average Cost")

显示图形

plt.show(

画出分区数量分别是678情况下客户规模从300350400450500550600的平均配送成本折线图字体为Times New Roman图例为P=6P=7P=8其中P为斜体给出python代码示例

原文地址: https://www.cveoy.top/t/topic/iojU 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录