-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathtotal_count_chart_maker_adjusted.py
More file actions
83 lines (63 loc) · 2.18 KB
/
Copy pathtotal_count_chart_maker_adjusted.py
File metadata and controls
83 lines (63 loc) · 2.18 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
"""
Makes the total count chart
"""
import numpy as np
import matplotlib.pyplot as plt
import sys
import matplotlib
from matplotlib.ticker import FuncFormatter
holo = []
mero = []
hyper = []
syn = []
hypo = []
with open("textfiles/total_adjusted_holo_counts.txt") as results:
for line in results.readlines():
holo.append(int(line.replace("\n", "").split(",")[1]))
with open("textfiles/total_adjusted_mero_counts.txt") as results:
for line in results.readlines():
mero.append(int(line.replace("\n", "").split(",")[1]))
with open("textfiles/total_adjusted_hyper_counts.txt") as results:
for line in results.readlines():
hyper.append(int(line.replace("\n", "").split(",")[1]))
with open("textfiles/total_adjusted_hypo_counts.txt") as results:
for line in results.readlines():
hypo.append(int(line.replace("\n", "").split(",")[1]))
with open("textfiles/total_adjusted_syn_counts.txt") as results:
for line in results.readlines():
syn.append(int(line.replace("\n", "").split(",")[1]))
holo = np.array(holo)
mero = np.array(mero)
hyper = np.array(hyper)
hypo = np.array(hypo)
syn = np.array(syn)
def to_percent(y, position):
# Ignore the passed in position. This has the effect of scaling the default
# tick locations.
s = str(int(round(100 * y)))
print s
# The percent symbol needs escaping in latex
if matplotlib.rcParams['text.usetex'] == True:
return s + r'$\%$'
else:
return s + '%'
#formatter = FuncFormatter(to_percent)
# Set the formatter
#plt.gca().yaxis.set_major_formatter(formatter)
# Fake data
x = np.arange(0, len(syn), 1)
area = 15 # 0 to 15 point radiuses
alpha = .4
plt.title("Count of relations by k")
plt.ylim(0, 350)
plt.xlim(0,200)
plt.scatter(x, syn, alpha=.4, label='Synonyms', color="blue")
plt.scatter(x, hyper, alpha=.4, label='Hypernyms', color="red")
plt.scatter(x, holo, alpha=.4, label='Holonyms', color="green")
plt.scatter(x, hypo, alpha=.4, label='Hyponyms', color="purple")
plt.scatter(x, mero, alpha=.4, label='Meronyms', color="orange")
plt.legend()
plt.xlabel("k")
plt.ylabel("Count")
plt.tight_layout()
plt.savefig('total_adjusted.png', bbox_inches='tight', pad_inches=.4)