-
Notifications
You must be signed in to change notification settings - Fork 2
/
plot.py
52 lines (35 loc) · 1.14 KB
/
plot.py
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
from matplotlib import pyplot as plt
import pickle
from math import *
with open('serialData.txt', 'r') as inp:
a = pickle.load(inp)
exec_time = pickle.load(inp)
xLabel = pickle.load(inp)
a = [log10(x) for x in a]
#exec_time = [log10(x) for x in exec_time]
# In[30]:
with open('parallelData.txt', 'r') as inp1:
a1 = pickle.load(inp1)
exec_time1 = pickle.load(inp1)
xLabel1 = pickle.load(inp1)
a1 = [log10(x) for x in a1]
#exec_time1 = [log10(x) for x in exec_time1]
# In[44]:
fig = plt.figure()
ax = fig.add_subplot(111)
#get_ipython().magic('matplotlib inline')
plt.title('Parallel vs Serial execution comparison')
plt.xlabel('log of number of Cities', color = 'blue')
plt.ylabel('execution time in minutes', color = 'blue')
plt.plot(a, exec_time, 'ro')
plt.plot(a, exec_time, label = 'serial', color = 'red')
plt.plot(a1, exec_time1, 'bo')
plt.plot(a1, exec_time1, label = 'parallel', color = 'blue')
plt.legend()
plt.xticks(a, xLabel, fontsize = 8)
ex = [int(x) for x in exec_time]
#plt.yticks(exec_time, ex, fontsize = 4)
# In[34]:
for a, b in zip(a, exec_time):
ax.annotate(str(int(b)), xy = (a, b))
plt.show()