gpt4 book ai didi

python - pyplot 绘制不同形状的图

转载 作者:行者123 更新时间:2023-12-01 08:48:23 24 4
gpt4 key购买 nike

我特别想让其中一行比另一行早结束。它们是按时间顺序排列的(逐月和逐年)。

months= [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
pass_2015 = [0, 0, 0, 0, 0, 134, 115, 185, 179, 147, 160, 126, 208, 48, 47, 50]
pass_2017 = [34, 106, 98, 162, 128, 166, 117, 123, 225, 161, 110, 100, 144, 53, 27, 10]
pass_2019 = [141,175,166,227,302,302,314]
plt.plot(months, pass_2015, color='gray')
plt.plot(months, pass_2017, color='green')
plt.plot(months, pass_2019, color='blue')

最佳答案

import matplotlib.pyplot as plt
months= [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
pass_2015 = [0, 0, 0, 0, 0, 134, 115, 185, 179, 147, 160, 126, 208, 48, 47, 50]
pass_2017 = [34, 106, 98, 162, 128, 166, 117, 123, 225, 161, 110, 100, 144, 53, 27, 10]
pass_2019 = [141,175,166,227,302,302,314]
plt.plot(months, pass_2015, color='gray')
plt.plot(months, pass_2017, color='green')
plt.plot(months[:len(pass_2019)], pass_2019, color='blue')
plt.show()

enter image description here

关于python - pyplot 绘制不同形状的图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53220678/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com