-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChartController.py
More file actions
27 lines (23 loc) · 850 Bytes
/
ChartController.py
File metadata and controls
27 lines (23 loc) · 850 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
class ChartController:
@staticmethod
def generateChart(trailsLengths, bestSolutions, worstSolutions, avgs):
if trailsLengths is None:
if len(bestSolutions) == 1:
plt.scatter(1, bestSolutions)
plt.scatter(1, worstSolutions)
plt.scatter(1, avgs)
else:
plt.plot(bestSolutions, label='best')
plt.plot(worstSolutions, label='worst')
plt.plot(avgs, label='avg')
plt.legend(loc="upper left")
else:
if len(trailsLengths) == 1:
plt.scatter(1, trailsLengths)
else:
plt.plot(trailsLengths)
plt.ylabel('Odległość')
plt.xlabel('Liczba iteracji/pokoleń')
plt.ion()
plt.show()