-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlotting.py
More file actions
27 lines (22 loc) · 752 Bytes
/
Plotting.py
File metadata and controls
27 lines (22 loc) · 752 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
import matplotlib.pyplot as plt
from settings import ALGORITHMS, a_names
def create_algorithm_plot(x_data, min_times, avg_times, max_times):
plt.plot(x_data, min_times, label="Minimum time")
plt.plot(x_data, avg_times, label="Average time")
plt.plot(x_data, max_times, label="Maximum time")
plt.xlabel("List Length")
plt.ylabel("Time taken (seconds)")
plt.title("Sorting Algorithm Performance")
plt.legend()
plt.grid(True)
plt.show()
def create_algorithms_plot(x_data, algorithms_data, title, x_label, y_label, n):
plt.figure(n)
for algorithm_name in a_names:
plt.plot(x_data, algorithms_data[algorithm_name], label=algorithm_name)
plt.xlabel(x_label)
plt.ylabel(y_label)
plt.title(title)
plt.legend()
plt.grid(True)
plt.show()