- 积分
- 1626
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-1-5
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
想要的结果如图,横轴年,纵轴表示出入梅(梅雨期)。我想了个思路,就是用bar实现,至做了几步,就不知道怎么搞了,请老师帮忙看看。脚本如下:
t_str = '2012-03-05'
startDate = ['2011-03-05','2012-03-22','2013-04-01','2014-03-03',
'2015-04-05','2016-02-28','2017-05-01','2018-03-23']
endDate = ['2011-07-08','2012-06-28','2013-07-07','2014-06-06',
'2015-06-25','2016-07-25','2017-08-01','2018-08-21']
d = datetime.datetime.strptime(startDate[0], '%Y-%m-%d')
print endDate[0]
span = []
daten = len(startDate)
for i in range(daten):
delta = datetime.datetime.strptime(endDate, '%Y-%m-%d')-datetime.datetime.strptime(startDate, '%Y-%m-%d')
#print delta.days
span.append(delta.days)
years = []
for i in range(2011, 2019):
years.append(i)
yearn = len(years)
bar(years,span)
xlim(2011, 2018)
ylim(0,365) |
|