-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultigraph.py
More file actions
67 lines (61 loc) · 2.25 KB
/
multigraph.py
File metadata and controls
67 lines (61 loc) · 2.25 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
66
67
import matplotlib.pyplot as plt
import numpy as np
import csv
import pandas as pd
import matplotlib.patches as mpatches
file = '/Users/victoria/Desktop/Sim/CSV/multino1part3.csv'
with open(file, newline='') as myFile:
reader = csv.reader(myFile)
df = pd.read_csv(file)
X = np.linspace(1, 500, 5000)
# df.plot() # plots all columns against index
aq = df.plot(kind='scatter', x='generation', y='locus_1', alpha=0.3,
c='orchid', label='Locus 1 Allele 1',
title=('Frequency Over Time'))
aq.set_xlabel('Time (generations)')
df.plot(kind='scatter', x='generation', y='locus_2', alpha=0.3,
c='darkblue',
label='Locus 2 Allele 1', ax=aq)
df.plot(kind='scatter', x='generation', y='locus_3', alpha=0.3,
c='red',
label='Locus 3 Allele 1', ax=aq)
df.plot(kind='scatter', x='generation', y='locus_4', alpha=0.3,
c='green',
label='Locus 4 Allele 1', ax=aq)
df.plot(kind='scatter', x='generation', y='locus_5', alpha=0.3,
c='yellow',
label='Locus 5 Allele 1', ax=aq)
df.plot(kind='scatter', x='generation', y='locus_6', alpha=0.3,
c='orange',
label='Locus 6 Allele 1', ax=aq)
df.plot(kind='scatter', x='generation', y='locus_7', alpha=0.3,
c='pink',
label='Locus 7 Allele 1', ax=aq)
df.plot(kind='scatter', x='generation', y='locus_8', alpha=0.3,
c='blue',
label='Locus 8 Allele 1', ax=aq)
df.plot(kind='scatter', x='generation', y='locus_9', alpha=0.3,
c='purple',
label='Locus 9 Allele 1', ax=aq)
df.plot(kind='scatter', x='generation', y='locus_10', alpha=0.3,
c='lightblue',
label='Locus 10 Allele 1', ax=aq)
aq.set_xlim(1, 100)
aq.set_xlabel('Time (generations)')
aq.set_ylabel('Allele Frequency')
plt.show()
at = df.plot(kind='scatter', x='generation', y='mean_fit', alpha=0.3,
c='black', label='Mean Fitness',
title=('Calculated Means'))
df.plot(kind='scatter', x='generation', y='mean_pheno', alpha=0.3,
c='red',
label='Mean Phenotype', ax=at)
aq.set_xlim(1, 100)
at.set_xlabel('Time (generations)')
at.set_ylabel('Mean Value')
plt.show()
x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# y = the formula?
plt.plot(x, y, linewidth=2.0)
plt.plot([1, 2, 3, 4], [7, 6, 5, 4], linewidth=2.0)
plt.show()