1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 【python堆积折线图】

【python堆积折线图】

时间:2022-10-22 08:05:18

相关推荐

【python堆积折线图】

# python堆积折线图import matplotlibimport matplotlib.pyplot as pltx = [1,2,3,4,5,6,7,8,9]y = [1,1,2,15,47,78,54,69,45]y1 = [0,0,2,2,1,10,37,40,35]y2 = [0,0,4,6,6,32,73,66,58]y3 = [0,0,0,4,4,5,12,12,14]y4 = [0,0,0,1,1,4,24,71,41]y5 = [0,0,0,1,0,3,0,0,0]y6 = [0,0,0,1,0,2,0,1,0]y7 = [0,0,0,0,0,1,3,13,3]y8 = [0,0,0,0,0,0,5,6,11]y9 = [0,0,0,0,0,0,1,2,0]fig, ax = plt.subplots(facecolor='white',figsize=(16,11))labels = ["1影视", "2动画", "3生活", "4游戏","5社科","7舞蹈","8动物圈","9歌曲","10运动","11鬼畜"]colors = ["#8da0cb", "#fc8d62", "#dbdcdc", "#7ea1b8","#a7d4d7","#f2f2f2","lightblue","lemonchiffon","lavender","#a1b1b9"]plt.xticks((1,2,3,4,5,6,7,8,9),('','','','','','','','',''), fontsize=10)#, rotation=90plt.stackplot(x,y,y1,y2, y3,y4,y5,y7,y8,y9, labels=labels, colors=colors, alpha=0.5)plt.ylim((0, 300))plt.legend(loc="upper left")plt.xlabel("Year", fontsize=13)plt.ylabel("Number", fontsize=13)plt.show()fig.savefig('堆积折线图.jpg', dpi=100)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。