import matplotlib.pyplot as plt # 产品销售额数据 product_a = [100, 150, 120, 180, 200, 250, 300, 280, 350, 400, 380, 450] product_b = [80, 120, 90, 150, 170, 200, 230, 210, 260, 300, 280, 330] product_c = [70, 90, 80, 120, 150, 180, 200, 190, 220, 270, 250, 300] # 月份数据 months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] # 绘制折线图 plt.plot(months, product_a, label='Product A') plt.plot(months, product_b, label='Product B') plt.plot(months, product_c, label='Product C') plt.title('Sales Trend by Product') plt.xlabel('Month') plt.ylabel('Sales ($)') plt.legend() plt.show()