forked from gmgu/graph-analysis-tool
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathlabel-vertex.py
More file actions
47 lines (42 loc) · 1.09 KB
/
label-vertex.py
File metadata and controls
47 lines (42 loc) · 1.09 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
from matplotlib import pyplot as plt
from matplotlib.ticker import MaxNLocator
import math
import sys
plt.switch_backend('agg')
graph_name = sys.argv[1]
# label-vertex
with open('./pyplot/label-vertex.txt', mode='rt') as f:
l=[]
n=[]
while True:
text=f.readline()
if not text:
break
text=text.split()
l=l+[int(text[0])]
n=n+[int(text[1])]
plt.figure(1)
ax = plt.figure(1).gca()
ax.xaxis.set_major_locator(MaxNLocator(integer=True))
plt.bar(l,n)
plt.xlabel('label')
plt.ylabel('# of vertex')
plt.title('label-vertex')
fig = plt.gcf()
fpath = "./pyplot/"+str(graph_name)+"_label-vertex.png"
fig.savefig(fpath, dpi=300)
#log scale
plt.figure(2)
plt.xscale('log')
plt.yscale('log')
xmax = max(l) * 2
ymax = max(n) * 2
plt.xlim(0.8, xmax)
plt.ylim(0.8, ymax)
plt.scatter(l,n)
plt.xlabel('label')
plt.ylabel('# of vertex')
plt.title('label-vertex_log')
fig = plt.gcf()
fpath = "./pyplot/"+str(graph_name)+"_label-vertex_log.png"
fig.savefig(fpath, dpi=300)