-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplot.py
More file actions
44 lines (30 loc) · 804 Bytes
/
plot.py
File metadata and controls
44 lines (30 loc) · 804 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
import matplotlib.pyplot as plt
ranges = []
timesRangeIndex = []
timesRangeSerial = []
k = []
timesKnnIndex = []
timesKnnSerial = []
fRange = open("statisticsRange.txt", "r")
fKNN = open("statisticsKNN.txt", "r")
for x in fRange:
y = x.split(" ")
ranges.append(y[0])
timesRangeIndex.append(int(y[1])*1.0/1000)
timesRangeSerial.append(int(y[2])*1.0/1000)
for x in fKNN:
y = x.split(" ")
k.append(y[0])
timesKnnIndex.append(int(y[1])*1.0/1000)
timesKnnSerial.append(int(y[2])*1.0/1000)
plt.subplot(2, 1, 1)
plt.plot(ranges, timesRangeIndex)
plt.plot(ranges, timesRangeSerial, 'r')
plt.ylabel("Time")
plt.xlabel("Range")
plt.subplot(2, 1, 2)
plt.plot(k, timesKnnIndex)
plt.plot(k, timesKnnSerial, 'r')
plt.ylabel("Time")
plt.xlabel("K-Neighbors")
plt.show()