Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 23rd, 2012  |  syntax: Python  |  size: 0.57 KB  |  views: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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()