import matplotlib.pyplot as plt # 销售额数据 sales = [1000, 1200, 1500, 1800, 2000, 2500] # 年份数据 years = ['2018', '2019', '2020', '2021', '2022', '2023'] # 绘制柱状图 plt.bar(years, sales) plt.title('Annual Sales') plt.xlabel('Year') plt.ylabel('Sales ($)') plt.show()