Skip to content
Snippets Groups Projects
Commit 693fedcf authored by NGUYEN Do Duc Anh's avatar NGUYEN Do Duc Anh
Browse files

draw vertical time

parent 9e4cca33
No related branches found
No related tags found
No related merge requests found
...@@ -810,7 +810,7 @@ def read_data(): ...@@ -810,7 +810,7 @@ def read_data():
array_def_notif = [] array_def_notif = []
array_nodef_infect = [] array_nodef_infect = []
for i in range(1, 2): for i in range(1, 3):
file_path = "measurement-" + str(i) + ".txt" file_path = "measurement-" + str(i) + ".txt"
# Read the contents of the file # Read the contents of the file
with open(file_path, 'r') as file: with open(file_path, 'r') as file:
...@@ -861,25 +861,39 @@ def plot(number_pc): ...@@ -861,25 +861,39 @@ def plot(number_pc):
lower_bounds.append(min(x)) lower_bounds.append(min(x))
upper_bounds.append(max(x)) upper_bounds.append(max(x))
# plt.plot(lower_bounds, [i for i in range(int(number_pc))], linestyle='dashed', label='Lower Bound') # # # plt.plot(lower_bounds, [i for i in range(int(number_pc))], linestyle='dashed', label='Lower Bound')
# plt.plot(upper_bounds, [i for i in range(int(number_pc))], linestyle='dashed', label='Upper Bound') # # # plt.plot(upper_bounds, [i for i in range(int(number_pc))], linestyle='dashed', label='Upper Bound')
plt.plot(average, [i for i in range(int(number_pc))]) # # plt.plot(average, [i for i in range(int(number_pc))])
# plt.fill_betweenx(range(len(average)), lower_bounds, upper_bounds, color='gray', alpha=0.3) # # # plt.fill_betweenx(range(len(average)), lower_bounds, upper_bounds, color='gray', alpha=0.3)
plt.errorbar(average, [i for i in range(int(number_pc))], # # plt.errorbar(average, [i for i in range(int(number_pc))],
xerr=[[average[i] - lower_bounds[i] for i in range(len(lower_bounds))], [upper_bounds[i] - average[i] for i in range(len(upper_bounds))]], color='orange', # # xerr=[[average[i] - lower_bounds[i] for i in range(len(lower_bounds))], [upper_bounds[i] - average[i] for i in range(len(upper_bounds))]], color='orange',
# # capsize=7, linestyle='', fmt='o', ecolor='black', label='Average')
# #
# # printMean(x_values[-1])
# # # print(f"Confidence interval: {mean} and {margin_of_error}")
# # plt.ylabel('Number of PCs', fontsize=18)
# # plt.xlabel('Time (s)', fontsize=18)
# plt.subplots_adjust(left=0.045, right=0.995, top=0.995, bottom=0.070)
# # plt.ylim(1)
# plt.xticks(fontsize=18)
# plt.yticks(pc_number_values, [i for i in range(int(number_pc))], linestyle='dashed', label='Lower Bound')
plt.plot([i for i in range(int(number_pc))], average)
plt.errorbar([i for i in range(int(number_pc))], average,
yerr=[[average[i] - lower_bounds[i] for i in range(len(lower_bounds))], [upper_bounds[i] - average[i] for i in range(len(upper_bounds))]], color='orange',
capsize=7, linestyle='', fmt='o', ecolor='black', label='Average') capsize=7, linestyle='', fmt='o', ecolor='black', label='Average')
plt.xlabel('Number of PCs', fontsize=18)
printMean(x_values[-1]) plt.ylabel('Time (s)', fontsize=18)
# print(f"Confidence interval: {mean} and {margin_of_error}")
plt.ylabel('Number of PCs', fontsize=18)
plt.xlabel('Time (s)', fontsize=18)
plt.subplots_adjust(left=0.045, right=0.995, top=0.995, bottom=0.070) plt.subplots_adjust(left=0.045, right=0.995, top=0.995, bottom=0.070)
# plt.ylim(1) plt.yticks(fontsize=18)
plt.xticks(fontsize=18) plt.xticks(pc_number_values, [str(i) for i in pc_number_values], fontsize=18)
plt.yticks(pc_number_values, [str(i) for i in pc_number_values], fontsize=18)
attack_stop_time = 0
for i in range(len(array_def_notif)):
attack_stop_time += array_def_notif[i][0][2] - array_def_infect[i][0][0]
attack_stop_time = array_def_notif[0][0][2] - array_def_infect[0][0][0] attack_stop_time = array_def_notif[0][0][2] - array_def_infect[0][0][0]
plt.axvline(x=attack_stop_time, color='red', linestyle='--', label="Attack Stopped") plt.axhline(y=attack_stop_time, color='red', linestyle='--', label="Attack Stopped")
plt.legend(fontsize=18) plt.legend(fontsize=18)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment