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

python绘制堆积折线图

时间:2021-09-18 15:39:28

相关推荐

python绘制堆积折线图

python绘制堆积折线图

import matplotlib.pyplot as pltx = [1,2,3,4,5,6,7,8]y = [169, 171, 170, 668, 936, 654, 883, 1806]y1 = [27, 379, 303, 916, 1254, 630, 512, 1088]y2 = [0, 5, 48, 296, 940, 3805, 4119, 1144]y3 = [42, 3131, 5804, 4787, 3081, 1493, 1045, 1520]fig, ax = plt.subplots(facecolor='white',figsize=(16,9))labels = ["Fully open", "Partially open", "Academic break", "Closed due to COVID-19"]colors = ["#8da0cb", "#fc8d62", "#66c2a5", "red"]plt.xticks((1,2,3,4,5,6,7,8),('-02','-03','-04','-05','-06','-07','-08','-09'), fontsize=10)#, rotation=90plt.stackplot(x, y, y1, y2, y3, labels=labels, colors=colors, alpha=0.5)plt.ylim((0, 12500))plt.legend(loc="upper left")plt.xlabel("Year", fontsize=13)plt.ylabel("Number", fontsize=13)plt.show()fig.savefig('堆积折线图.jpg', dpi=200)

欢迎加群:69909

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