The script plottest.py.txt reads the data file (out.txt) and creates the plot 
(myfig.png); however,
I am unable to format the dates ... they always print as floats .. help
 
the files plottest.py.txt, out.txt and myfig.png are attached
 
 
Thanks
 
Andy


      
import time
import csv
import matplotlib
matplotlib.use('Agg')
from pylab import datestr2num
import matplotlib.mlab as ml
import matplotlib.pyplot as plt
import matplotlib.dates as mdates


t=[]
v1=[]
v2=[]
v3=[]

FileReader = csv.reader(open('out.txt'), delimiter='    ', quotechar='"')


for row in FileReader:
   # t.append(time.mktime(time.strptime(row[0], '%Y-%m-%d %H:%M:%S')))
   t.append(float(row[0]))
   v1.append(float(row[1]))
   v2.append(float(row[2]))
   v3.append(float(row[3]))

for tstamp in t:
   print tstamp

for val in v1:
   print val

fig = plt.figure()
ax = fig.add_subplot(111)

ax.plot(t,v1)
ax.fmt_xdata = mdates.DateFormatter('%Y-%m-%d %H:%M:%S')

fig.autofmt_xdate()

plt.ylabel('iops')
plt.xlabel('tstamp')

# plt.show()
plt.savefig('myfig')




# load('out.txt', delimiter=',',converters={0:datestr2num}, skiprows=1, 
usecols=(0,2),unpack=True)

1240003749.56   5356    3074    253     0
1240003754.71   3173    2003    272     0
1240003755.93   7326    3609    126     0
1240003756.72   7326    3609    126     0
1240003757.42   3534    1655    747     0
1240003758.22   3534    1655    747     0
1240003759.3    2401    1290    225     0
1240003760.81   2259    1086    199     0
1240003761.98   1958    1162    347     0

<<attachment: myfig.png>>

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to