用python进行图标生成和展示

import matplotlib.pyplot as plt
#由于该库对中文的显示不好
#用来正常显示中文标签
plt.raParams['font.sans_serif']=['SimHei']
#初始数据
date=['2018/7/21','2018/7/22','2018/7/23','2018/7/24','2018/7/25','2018/7/26','2018/7/27','2018/7/28','2018/7/29','2018/7/30',]
hebei=[69,93,65,65,25,254,652,45,11,114]
shanxi=[32,52,54,45,585,22,66,35,966,522]
#####折线图#####
plt.plot(date,hebei,color='red',label='河北')
plt.plot(date,shanxi,color='blue',label='山西')
plt.title('每日入库量对比')
plt.xlable('日期')
plt.ylable('车次')


#刻印  即把图画出来
plt.legend()
plt.show()


####柱状图####
plt.bar(date,hebei,color='red',label='河北')
plt.legend()
plt.show()


####水平柱状图###
plt.barh(date,hebei,color='red',label='河北')
plt.legend()
plt.show()
####饼图###
number=[666,251]
province=['河北','山西']
colors=['#999fff','#fff99']
plt.pie(x=number,labels=province,colors=colors)
plt.legend()
plt.show()

你可能感兴趣的:(学习笔记)