Python绘制Face Cream 售卖量条形图:示例与代码
import matplotlib.pyplot as plt
数据
month_number = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] facecream = [2500, 2630, 2140, 3400, 3600, 2760, 2980, 3700, 3540, 1990, 2340, 2900]
绘图
plt.bar(month_number, facecream)
图例
plt.legend(['face cream'], loc='upper left')
图题
plt.title('图三:洗面奶和面霜售卖量对比条形图')
X轴标签
plt.xlabel('Month Number')
Y轴标签
plt.ylabel('Sales Units in Number')
添加网格
plt.grid(True, linestyle='-')
显示图形
plt.show()
原文地址: https://www.cveoy.top/t/topic/bHn7 著作权归作者所有。请勿转载和采集!