|
From: luis n. <lui...@gm...> - 2015-02-04 07:04:09
|
Hi everyone,
I would to know what is the bast way to handle datetime for the x axis. for
example I have a datetime objects in a list and an numpy array in the other.
I tried many things, among them I tried this:
g=Gnuplot.Gnuplot(debug=1,persist=True)
g.reset()
g('set xdata time')
g('set timefmt "%s"')
g('set format x "%M:%S"')
fecha=datetime(year,month,day)
times=[]
data=[]
for iobj in objects:
data.append(iobj.data)
times.append((iobj.datetime-datetime(1970,1,1,tzinfo=pytz.UTC)).total_seconds())
data=numpy.array(data)
times=numpy.array(times)
gnudata = Gnuplot.Data(times,data,using=(1,2),with_='line',title='mean')
g.plot(gnudata)
Thanks.
--
Atte.
Luis Navarro Domínguez
|