-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplot_bars.py
More file actions
executable file
·42 lines (34 loc) · 985 Bytes
/
plot_bars.py
File metadata and controls
executable file
·42 lines (34 loc) · 985 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
#!/usr/bin/env python3
#coding: utf-8
import sys
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors
from collections import defaultdict
# dist
ind_value = list()
# infl/der
ind_is_infl = list()
with open(sys.argv[1]) as infile:
# strip headers
infile.readline()
infile.readline()
for line in infile:
line = line.rstrip('\n')
items = line.split("\t")
if (items[0].startswith('===')):
ind_value.append(1.0)
ind_is_infl.append('r')
else:
dist = float(items[3])
is_infl = 'b' if items[2] == 'INFL' else 'y'
ind_value.append(dist)
ind_is_infl.append(is_infl)
plt.figure(1)
#s = np.argsort(ind_value)
#x = np.arange(len(ind_value))
#plt.bar(x, height=[ind_value[k] for k in s], color=[ind_is_infl[k] for k in s])
r = range(len(ind_value))
plt.bar(r, height=ind_value, color=ind_is_infl)
#plt.show()
plt.savefig(sys.argv[1] + '.pdf')