Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Onyxia, 2005, 1, 30, 1,
- Molten Core, 2005, 4, 25, 10,
- Zul'Gurub, 2005, 9, 13, 10,
- Blackwing Lair, 2005, 9, 26, 8,
- AQ20, 2006, 1, 3, 6,
- AQ40, 2006, 4, 25, 9,
- Naxxramas, 2006, 9, 9, 15,
- Karazhan, 2007, 1, 28, 11,
- Gruul, 2007, 2, 3, 2,
- Magtheridon, 2007, 2, 24, 1,
- Serpentshrine Cavern, 2007, 3, 29, 6,
- Tempest Keep, 2007, 5, 25, 5,
- Black Temple, 2007, 6, 5, 9,
- Hyjal, 2007, 6, 9, 5,
- Zul'Aman, 2007, 11, 13, 6,
- Sunwell, 2008, 5, 25, 5,
- Sartharion, 2008, 11, 13, 1,
- Malygos, 2008, 11, 13, 1,
- Ulduar, 2009, 7, 7, 14,
- Trial of the Crusader, 2009, 9, 17, 5,
- Icecrown Citadel, 2010, 3, 26, 12,
- Halion, 2010, 6, 30, 1,
- Blackwing Descent, 2011, 2, 11, 6,
- Bastion of Twilight, 2011, 2, 2, 5,
- Throne of the Four Winds, 2011, 1, 24, 2,
- Firelands, 2011, 7, 22, 7,
- Dragon Soul, 2011, 12, 26, 8,
- Mogu'Shan Vaults, 2012, 10, 13, 6,
- Heart of Fear, 2012, 11, 11, 6,
- Terrace of Endless Spring, 2012, 11, 25, 4,
- Throne of Thunder, 2013, 4, 17, 13,
- Siege of Orgrimmar, 2013, 10, 5, 14,
- Highmaul, 2014, 12, 14, 7,
- Blackrock Foundry, 2015, 2, 20, 10,
- Hellfire Citadel, 2015, 7, 16, 13,
- Legion, 2016, 9, 21, 10
- '''
- days = [31,28,31,30,31,30,31,31,30,31,30,31]
- d = open("data.txt","r")
- data = d.read()
- d.close()
- sldata = data.split(",")
- n = len(sldata)/5 #number of rows
- names, T, dT, Y = [],[],[],[]
- for i in range(n):
- names.append(sldata[5*i][1:])
- y = int(sldata[5*i+1])
- m = int(sldata[5*i+2])
- d = int(sldata[5*i+3])
- T.append(y + (m*days[m-1] + d)/365.0)
- Y.append(int(sldata[5*i+4]))
- dT.append(T[1]-T[0])
- for i in range(1,n-1):
- dT.append((T[i+1]-T[i-1])/2)
- dT.append(T[n-1]-T[n-2])
- Yw = []
- for i in range(0,n):
- Yw.append(Y[i]/dT[i])
- from numpy import *
- from matplotlib.pyplot import *
- xd = linspace(T[0]-0.1,T[n-1]+0.1,2500)
- pdf = Y[0]*np.exp(-(xd-T[0])**2/Y[0]/0.00001)
- for i in range(1,n):
- pdf+= Y[i]*np.exp(-(xd-T[i])**2/Y[i]/0.00001)
- fig, ax = subplots()
- plot(xd,pdf)
- ylabel('B',rotation=0)
- xlabel('Year')
- ylim(-0.01,max(pdf)+1.5)
- xlim(T[0]-0.1,T[n-1]+0.1)
- x_formatter = matplotlib.ticker.ScalarFormatter(useOffset=False)
- ax.xaxis.set_major_formatter(x_formatter)
- def randcolor():
- r = lambda: random.randint(0,255)
- return('#%02X%02X%02X' % (r(),r(),r()))
- for i in range(n):
- ax.annotate(names[i],xy=(T[i],Y[i]),
- xytext=(T[i]-random.rand(),Y[i]+0.3+abs(1.75*sin(random.rand()*pi))),
- arrowprops=dict(arrowstyle="->", connectionstyle="arc3", color=randcolor()),
- )
- show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement