In [1]:
'''
Read a file that looks like this:
2013-03-26 08:51:18 69.35 20.75
2013-03-26 08:56:19 69.35 20.75
2013-03-26 09:01:19 69.125 20.625
2013-03-26 09:06:20 69.6866 20.937
2013-03-26 09:11:21 69.35 20.75
2013-03-26 09:16:21 69.2366 20.687
2013-03-26 09:21:22 69.2366 20.687
''';
In [2]:
import numpy as np
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
In [3]:
log_file = './data/temperaturedata2013-03-25-22-19-23.log'
data=np.genfromtxt(log_file,dtype=None,names=['date','time','F','C'])
In [4]:
dates=mdates.datestr2num(data['date']) # get the integer day
times,null=np.modf(mdates.datestr2num(data['time'])) # get fractional day
In [5]:
jd=dates+times # add fractional day to integer day
In [6]:
fig=plt.figure(figsize=(10,5))
ax1 = fig.add_subplot(111)
ax1.plot_date(jd,data['C'],'ko-');
plt.grid()
plt.ylabel('Temp')
Out[6]: