import matplotlib.pyplot as plt
plt.rcParams['font.family'] = "STSong"
years = ["2012","2013","2014","2015","2016"]
baokao_nums = [172,163,188,190,200]
luqu_nums=[50,60,70,80,90]
x=range(len(years))
plt.bar(x,height=baokao_nums,width=0.4)
plt.bar([i +0.4 for i in x],luqu_nums,width=0.4)
plt.xticks([i + 0.2 for i in x],years)
plt.xlabel("年份")
plt.ylabel("人数")
plt.legend(["研究生报考人数","研究生录取人数"])
plt.savefig('../P&Q/test5.png')
plt.show()
柱状图.pythen
最新推荐文章于 2024-09-15 22:31:42 发布