0

I have four columns of data imported using pandas:

DayOfYear Time             Field  Distance
1         09:00:00          50      100
1         10:00:00          51      110 
1         11:00:00          52      130
2         09:00:00          54      170
2         10:00:00          55      200
2         11:00:00          56      220
3         09:00:00          58      250 
3         10:00:00          59      280
3         11:00:00          60      300
4         09:00:00          61      320  
4         10:00:00          63      350
4         11:00:00          65      400
5         09:00:00          66      420 
5         10:00:00          68      450
5         11:00:00          70      500
6         09:00:00          72      520
6         10:00:00          74      560
6         11:00:00          75      600
7         09:00:00          77      630
7         10:00:00          79      670
7         11:00:00          80      700
...          

So far I have needed to plot Field against Distance for whichever range of days that i need which i have done by using

startday = 1
endday= 6
plt.plot(rawdata[rawdata['Day'].between(startday,endday)].set_index('Distance')['Field'])

Now on the same plot i would like to highlight a region for specific time range. So I'd like to highlight , along the distance axis, for day 3 between 8AM to 10AM.

CodingKid
  • 33
  • 1
  • 4
  • Does this answer your question? [Fill between two vertical lines in matplotlib](https://stackoverflow.com/questions/23248435/fill-between-two-vertical-lines-in-matplotlib) – rpanai Jan 27 '20 at 17:37
  • That's what i want to do, but i have thousands of lines of data and time ranges that repeat. So how do I get the corresponding Distance values to make this highlight for the time range of the specific day that i want? – CodingKid Jan 27 '20 at 17:41
  • I guess it will be easier if you set your date in `YYYY-MM-DD HH:MM:SS` format. – rpanai Jan 27 '20 at 17:50

0 Answers0