-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplot_bars_cutoff.py
More file actions
executable file
·46 lines (37 loc) · 1.07 KB
/
plot_bars_cutoff.py
File metadata and controls
executable file
·46 lines (37 loc) · 1.07 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
#!/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:
thresh_line = infile.readline().split()
thresh = float(thresh_line[2])
# strip headers
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)
if dist > 2*thresh:
break
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')