马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
x=range(len(pe_list))
print(x):
range(0, 120)
print(my_x):
[datetime.date(2020, 5, 29), datetime.date(2020, 4, 30), datetime.date(2020, 3, 31), datetime.date(2020, 2, 28), datetime.date(2020, 1, 23), datetime.date(2019, 12, 31), datetime.date(2019, 11, 29), datetime.date(2019, 10, 31), datetime.date(2019, 9, 30), datetime.date(2019, 8, 30), datetime.date(2019, 7, 31), datetime.date(2019, 6, 28), datetime.date(2019, 5, 31), datetime.date(2019, 4, 30), datetime.date(2019, 3, 29), datetime.date(2019, 2, 28), datetime.date(2019, 1, 31), datetime.date(2018, 12, 28), datetime.date(2018, 11, 30), datetime.date(2018, 10, 31), datetime.date(2018, 9, 28), datetime.date(2018, 8, 31), datetime.date(2018, 7, 31), datetime.date(2018, 6, 29), datetime.date(2018, 5, 31), datetime.date(2018, 4, 27), datetime.date(2018, 3, 30), datetime.date(2018, 2, 28), datetime.date(2018, 1, 31), datetime.date(2017, 12, 29), datetime.date(2017, 11, 30), datetime.date(2017, 10, 31), datetime.date(2017, 9, 29), datetime.date(2017, 8, 31), datetime.date(2017, 7, 31), datetime.date(2017, 6, 30), datetime.date(2017, 5, 31), datetime.date(2017, 4, 28), datetime.date(2017, 3, 31), datetime.date(2017, 2, 28), datetime.date(2017, 1, 26), datetime.date(2016, 12, 30), datetime.date(2016, 11, 30), datetime.date(2016, 10, 31), datetime.date(2016, 9, 30), datetime.date(2016, 8, 31), datetime.date(2016, 7, 29), datetime.date(2016, 6, 30), datetime.date(2016, 5, 31), datetime.date(2016, 4, 29), datetime.date(2016, 3, 31), datetime.date(2016, 2, 29), datetime.date(2016, 1, 29), datetime.date(2015, 12, 31), datetime.date(2015, 11, 30), datetime.date(2015, 10, 30), datetime.date(2015, 9, 30), datetime.date(2015, 8, 31), datetime.date(2015, 7, 31), datetime.date(2015, 6, 30), datetime.date(2015, 5, 29), datetime.date(2015, 4, 30), datetime.date(2015, 3, 31), datetime.date(2015, 2, 27), datetime.date(2015, 1, 30), datetime.date(2014, 12, 31), datetime.date(2014, 11, 28), datetime.date(2014, 10, 31), datetime.date(2014, 9, 30), datetime.date(2014, 8, 29), datetime.date(2014, 7, 31), datetime.date(2014, 6, 30), datetime.date(2014, 5, 30), datetime.date(2014, 4, 30), datetime.date(2014, 3, 31), datetime.date(2014, 2, 28), datetime.date(2014, 1, 30), datetime.date(2013, 12, 31), datetime.date(2013, 11, 29), datetime.date(2013, 10, 31), datetime.date(2013, 9, 30), datetime.date(2013, 8, 30), datetime.date(2013, 7, 31), datetime.date(2013, 6, 28), datetime.date(2013, 5, 31), datetime.date(2013, 4, 26), datetime.date(2013, 3, 29), datetime.date(2013, 2, 28), datetime.date(2013, 1, 31), datetime.date(2012, 12, 31), datetime.date(2012, 11, 30), datetime.date(2012, 10, 31), datetime.date(2012, 9, 28), datetime.date(2012, 8, 31), datetime.date(2012, 7, 31), datetime.date(2012, 6, 29), datetime.date(2012, 5, 31), datetime.date(2012, 4, 27), datetime.date(2012, 3, 30), datetime.date(2012, 2, 29), datetime.date(2012, 1, 31), datetime.date(2011, 12, 30), datetime.date(2011, 11, 30), datetime.date(2011, 10, 31), datetime.date(2011, 9, 30), datetime.date(2011, 8, 31), datetime.date(2011, 7, 29), datetime.date(2011, 6, 30), datetime.date(2011, 5, 31), datetime.date(2011, 4, 29), datetime.date(2011, 3, 31), datetime.date(2011, 2, 28), datetime.date(2011, 1, 31), datetime.date(2010, 12, 31), datetime.date(2010, 11, 30), datetime.date(2010, 10, 29), datetime.date(2010, 9, 30), datetime.date(2010, 8, 31), datetime.date(2010, 7, 30), datetime.date(2010, 6, 30)]
y=pe_list
print(y)
[21.0714, 23.4368, 22.784100000000002, 23.5442, 26.8306, 25.3977, 25.506050000000002, 26.1003, 27.84735, 25.6969, 23.5059, 22.2147, 22.5135, 23.0357, 21.7986, 19.565849999999998, 19.9915, 18.6973, 15.9918, 18.1316, 20.7996, 18.82265, 21.3135, 21.6533, 19.181, 18.61455, 18.60255, 18.771349999999998, 19.3828, 17.6608, 19.9371, 21.320549999999997, 22.4719, 21.5672, 21.9004, 22.49335, 18.5596, 17.287100000000002, 20.224, 21.6998, 19.1002, 19.7416, 21.514699999999998, 19.580550000000002, 20.2185, 18.5406, 19.653399999999998, 19.56055, 20.73705, 21.53675, 22.0731, 25.1236, 23.9519, 26.1862, 29.7093, 30.9293, 32.586349999999996, 36.95665, 38.965, 43.63495, 37.8506, 30.9324, 26.264, 24.6439, 28.945349999999998, 28.469549999999998, 30.1106, 21.90835, 22.00845, 23.6442, 23.1191, 23.075499999999998, 24.12925, 26.23235, 27.126350000000002, 26.69695, 25.59225, 25.847749999999998, 27.4232, 27.4457, 27.4483, 28.1114, 28.10595, 27.43905, 28.2228, 27.6862, 27.8536, 27.4294, 28.8097, 27.478, 26.7538, 26.5843, 25.482300000000002, 25.1025, 23.1735, 23.0626, 20.2134, 19.8988, 17.9294, 18.22355, 16.4768, 16.747, 16.2834, 16.9771, 21.4065, 22.6634, 21.707050000000002, 19.3051, 21.153599999999997, 21.05305, 21.0379, 21.1223, 20.26175, 20.389400000000002, 22.42495, 21.2586, 21.161299999999997, 18.7911, 22.606, 21.30205]
plt.plot(x, y, label="pe中位数")
plt.show()
plt.plot(my_x, y, label="pe中位数")
plt.show()
现在画出来的图,不一样。尝试了半天还不会传图片。。。。
目前的问题是:
y的数据是一样的,把x替换成了日期,结果图的走势差别很大,这没道理啊
本帖最后由 BIO-张磊 于 2020-6-23 12:39 编辑
当以日期做横坐标轴的时候。
你的日期 以升序排序了。
自己拿个镜子照一下就发现了
或者对于两张图,A图你从左往右看,B图你从右往左看
|