8 import matplotlib
.pyplot
as plt
11 from matplotlib
.ticker
import MultipleLocator
14 googlefn
= 'google_data.csv'
16 yahoofn
= 'yahoo_data.csv'
19 if not os
.path
.exists(fn
):
20 print "%s not found"%fn
28 return np
.loadtxt(fn
,skiprows
=1,unpack
=True,delimiter
=',')
30 google_x
, google_y
= loadcsv(googlefn
)
31 ny_x
, ny_y
= loadcsv(nyfn
)
32 yahoo_x
,yahoo_y
= loadcsv(yahoofn
)
35 lg
= pylab
.plot(google_x
,google_y
,color
='blue',label
='Google Stock Value',linewidth
=1.5)
36 ly
= pylab
.plot(yahoo_x
,yahoo_y
,color
='purple',label
='Yahoo Stock Value',linewidth
=1.5)
39 pylab
.xlabel('Date (MJD)')
40 pylab
.ylabel('Value (Dollars)')
41 pylab
.suptitle('New York Temperature, Google, and Yahoo!',fontsize
=20)
43 minorLocator
= MultipleLocator(20)
45 ax
.yaxis
.set_minor_locator(minorLocator
)
49 lny
= pylab
.plot(ny_x
,ny_y
,color
='red',linestyle
='--',label
='NY Mon. High Temp',linewidth
=1.5)
52 pylab
.legend((ly
,lg
,lny
),('Yahoo! Stock Value','Google Stock Value','NY Mon. High Temp'),loc
=6,frameon
=False,prop
={'size':10})
54 minorLocator
= MultipleLocator(200)
55 ax
.xaxis
.set_minor_locator(minorLocator
)
56 minorLocator
= MultipleLocator(10)
57 ax2
.yaxis
.set_minor_locator(minorLocator
)
59 pylab
.xlim(48800,55600)
61 pylab
.ylabel('Temperature ($^\circ$F)')
63 pylab
.savefig('student-stocks.png',dpi
=200)