-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotting.py
More file actions
44 lines (34 loc) · 771 Bytes
/
plotting.py
File metadata and controls
44 lines (34 loc) · 771 Bytes
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
## plotting.py Version 1.0
## By Magnus Berg Sletfjerding
##############################################
'''
Importing modules
'''
import matplotlib.pyplot as plt
from math import isnan
'''
Importing file data
'''
en_list = []
e = open('energy_list.txt', 'r')
for line in e:
en_list.append(float(line))
ene_list = [x for x in en_list if isnan(x) == 0]
hist = 1
'''
Plotting
'''
if hist == 1:
plt.hist(ene_list)
plt.title("Histogram of MMFF94 Energies")
filename = 'energy_list_hist.png'
plt.xlabel("Energy value")
plt.ylabel("Frequency")
else:
plt.plot(ene_list)
plt.title("Graph of MMFF94 Energies")
filename = 'energy_list_graph.png'
plt.ylabel("Energy value")
plt.xlabel("Step")
# plt.show()
plt.savefig(filename)