Using matplotlib.dates.datestr2num , you can easily convert your first column to paid numbers, but I did not find a function for your second column. You can build a function to handle, though:
import numpy as np def calc_hour( str ): hour, min, sec = [float(i) for i in str.split(':')] min += sec/60. hour += min/60. return hour calc_hour = np.vectorize( calc_hour ) def calc_deg( str ): deg, min, sec = [float(i) for i in str.split(':')] min += sec/60. deg += min/60. return deg calc_deg = np.vectorize( calc_deg )
Then read the data from the intended tmp.txt file:
values = np.loadtxt('tmp.txt', dtype=str) hours= calc_hour( values[:,0] ) degs = calc_deg( values[:,1] )
Getting something like:
hours = array([ 0.10133333, 0.11713889, 0.23825 , 0.38333333, 0.39730556, 0.39844444, 0.39983333, 0.40102778, 0.40105556, 0.40108333, 0.50836111]) degs = array([-70., -66., -59., -52., -49., -29., -28., -26., -14., 25., 30.])
This can be built:
import matplotlib.pyplot as plt plt.plot(hours,degs)
For you, giving:
