-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPloting.py
More file actions
65 lines (49 loc) · 2.06 KB
/
Ploting.py
File metadata and controls
65 lines (49 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import matplotlib.pyplot as plt
import numpy as np
def Plot (data, uppgift = '1a',figure=1,m=0.1,s=0.1):
if(uppgift == '2a'):
sumaaInPopulation_1 = data[0,:]
sumAAInPopulation_1 = data[1,:]
sumAaInPopulation_1 = data[2,:]
sumaaInPopulation_2 = data[3,:]
sumAAInPopulation_2 = data[4,:]
sumAaInPopulation_2 = data[5,:]
lengthData = sumaaInPopulation_1.shape[1]
X = np.linspace(0,lengthData-1,lengthData)
#print('X',X,'\naa',sumaaInPopulation_1[0,:])
plt.figure(figure)
strFigureTitle = 'Migration value = '+str(m)+' s = '+str(s)
plt.suptitle(strFigureTitle, fontsize=16)
plt.subplot(2, 3, 1)
plt.plot(X, sumaaInPopulation_1[0,:], '-')
plt.title('Genotype aa Population 1')
plt.subplot(2, 3, 2)
plt.plot(X, sumAAInPopulation_1[0,:], '-')
plt.title('Genotype AA Population 1')
plt.subplot(2, 3, 3)
plt.plot(X, sumAaInPopulation_1[0,:], '-')
plt.title('Genotype Aa Population 1')
plt.subplot(2, 3, 4)
plt.plot(X, sumaaInPopulation_2[0,:], '-')
plt.title('Genotype AA Population 2')
plt.subplot(2, 3, 5)
plt.plot(X, sumAAInPopulation_2[0,:], '-')
plt.title('Genotype aa Population 2')
plt.subplot(2, 3, 6)
plt.plot(X, sumAaInPopulation_2[0,:], '-')
plt.title('Genotype Aa Population 2')
if (uppgift == '2b'):
frequencyAPopulation1 = data[6, :]
frequencyAPopulation2 = data[7, :]
lengthData = data[6, :].shape[1]
X = np.linspace(0, lengthData - 1, lengthData)
# print('X',X,'\naa',sumaaInPopulation_1[0,:])
plt.figure(figure)
strFigureTitle = 'Migration value = ' + str(m) + ' s = ' + str(s)
plt.suptitle(strFigureTitle, fontsize=16)
plt.subplot(2, 1, 1)
plt.plot(X, frequencyAPopulation1[0, :], '-')
plt.title('A frequency Population 1')
plt.subplot(2, 1, 2)
plt.plot(X, frequencyAPopulation2[0, :], '-')
plt.title('A frequency Population 2')