def plotLattice(): p.figure() p.hold('on') sd = np.where(I==-1) #spin down su = np.where(I==1) #spin up l = str(L) p.scatter(sd[0],sd[1],color='black',title='2D Ising Model Size: '+l+'x'+l) p.scatter(su[0],su[1],color='blue')
uefa_data = sports[sports.keys()[4]][:] dob_months = [int(dob.split('-')[1]) for dob in uefa_data['DOB']] mCount = Counter(dob_months) for c in mCount: print c, mCount[c] months = mCount.keys() soccer = np.array(mCount.values()) p.plot(months,soccer,width=500, height=300,title='Number of Births per Month for UEFA 2012') #http://www.cdc.gov/nchs/data/nvsr/nvsr60/nvsr60_01_tables.pdf#I02 #birth rates per month across USA 2009 US_Total_2009 = np.array([337980,316641,347803,337272,345257,346971,368450,359554\ ,361922,347625,320195,340995],dtype='float64') p.figure() p.plot(months,US_Total_2009,width=500, height=300,title='Totals Births per Month 2009 (USA)') p.figure() soccer_normed = soccer/float(soccer.max()) US_normed = US_Total_2009/float(US_Total_2009.max())+.2 p.hold('on') p.plot(months,US_normed,width=500, height=300,color='red',title='Normalized Birthrates per Month<br/>Red: USA (2009 shifted .2), Blue: NBA') p.plot(months,soccer_normed,color='blue')
from webplot import p p.use_doc('webplot example') import numpy as np import datetime import time x = np.arange(100) / 6.0 y = np.sin(x) z = np.cos(x) data_source = p.make_source(idx=range(100), x=x, y=y, z=z) p.plot(x, y, 'orange') p.figure() p.plot('x', 'y', color='blue', data_source=data_source, title='sincos') p.plot('x', 'z', color='green') p.figure() p.plot('x', 'y', data_source=data_source) p.figure() p.plot('x', 'z', data_source=data_source) p.figure() p.table(data_source, ['x', 'y', 'z']) p.scatter('x', 'y', data_source=data_source) p.figure() p.scatter('x', 'z', data_source=data_source) p.figure() p.hold(False) p.scatter('x', 'y', 'orange', data_source=data_source) p.scatter('x', 'z', 'red', data_source=data_source) p.plot('x', 'z', 'yellow', data_source=data_source) p.plot('x', 'y', 'black', data_source=data_source) print "click on the plots tab to see results"