-
Notifications
You must be signed in to change notification settings - Fork 0
/
count.py
49 lines (34 loc) · 1.5 KB
/
count.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
import matplotlib.pyplot as plt
import numpy as np
with open("./local_machine_res/data.txt", "r") as f:
analysis_data_input = f.read()
with open("./docker_res/data.txt", "r") as f:
analysis_data_docker_input = f.read()
analysis_data = analysis_data_input.split(" ")
analysis_data_docker = analysis_data_docker_input.split(" ")
analysis_data = analysis_data[:-1]
analysis_data_docker = analysis_data_docker[:-1]
analysis_data_docker = [float(i) for i in analysis_data_docker]
analysis_data_docker = [int(i) for i in analysis_data_docker]
analysis_data = [float(i) for i in analysis_data]
analysis_data = [int(i) for i in analysis_data]
print(analysis_data)
print(len(analysis_data))
x = range(1, len(analysis_data) + 1)
x2 = range(1, len(analysis_data_docker) + 1)
# Create the plot
plt.figure(figsize=(10, 6))
plt.plot(x, analysis_data, marker='o', linestyle='-', color='r')
plt.plot(x2, analysis_data_docker, marker='o', linestyle='-', color='b')
plt.title('Analysis Data Plot')
plt.xlabel('Times')
plt.ylabel('Execution Time')
plt.grid(True)
plt.ylim(0, 70) # Ensure y-axis starts at 0 and has some space above the max value
plt.xticks(np.arange(min(x), max(x)+1, 1.0))
for i, value in enumerate(analysis_data):
plt.annotate(value, (x[i], analysis_data[i]), textcoords="offset points", xytext=(0,10), ha='center')
for i, value in enumerate(analysis_data_docker):
plt.annotate(value, (x2[i], analysis_data_docker[i]), textcoords="offset points", xytext=(0,10), ha='center')
# Show the plot
plt.show()