SHARE
TWEET

Untitled

a guest Nov 23rd, 2012 27 Never
  1. import string, re, pylab
  2.  
  3. xAxis=[]
  4. yAxis=[]
  5.  
  6. def loadData():
  7.     dataFile=open('julyTemps.5ee3cdb7fafe.txt', 'r', 0)
  8.     for line in dataFile:
  9.         for c in string.digits:
  10.             if re.match(c, line):
  11.                 xAxis.append(line.split()[0])
  12.                 yAxis.append(line.split()[1])
  13.     dataFile.close()
  14. loadData()
  15.  
  16. def makePlot():
  17.     pylab.figure(1)
  18.     pylab.title('Boston July Highest Temperatures')
  19.     pylab.xlabel('Day')
  20.     pylab.ylabel('Highest Temperature (F)')
  21.     pylab.plot(xAxis, yAxis, 'r', linewidth=3)
  22.     pylab.show()
  23. makePlot()
RAW Paste Data
Top