import matplotlib.pyplot as plt
# 示例数据
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May']
sales = [200, 220, 250, 270, 300]
# 创建折线图
plt.plot(months, sales, marker='o')
plt.title('Monthly Sales Trend')
plt.xlabel('Month')
plt.ylabel('Sales (in $)')
plt.grid(True)
plt.show()
]]>
plt.bar(months, sales, color='skyblue')
plt.title('Monthly Sales by Bar Chart')
plt.xlabel('Month')
plt.ylabel('Sales (in $)')
plt.show()
]]>