def update(i): for ax in self.figure.get_axes(): ax.clear() graph_list(0, self.options, self.graph, 0, 0, None) for n in range(len(self.graph['p']) - 1): graph_list(3, self.options, self.graph, i, n, self.ants) plt.gca().invert_yaxis() self.figure.canvas.draw()
def action(self, state): for ax in self.figure.get_axes(): ax.clear() graph_list(0, self.options, self.graph, 0, 0, None) if state == True: graph_list(1, self.options, self.graph, self.length, 0, None) plt.gca().invert_yaxis() self.figure.canvas.draw()
def optimum_path(self, state): for ax in self.figure.get_axes(): ax.clear() graph_list(0, self.options, self.graph, 0, 0, None) if state == True: for n in range(len(self.graph['p']) - 1): graph_list(2, self.options, self.graph, self.length, n, None) plt.gca().invert_yaxis() self.figure.canvas.draw()
def ants_path(self, state): for ax in self.figure.get_axes(): ax.clear() graph_list(0, self.options, self.graph, 0, 0, None) if state == True: def update(i): for ax in self.figure.get_axes(): ax.clear() graph_list(0, self.options, self.graph, 0, 0, None) for n in range(len(self.graph['p']) - 1): graph_list(3, self.options, self.graph, i, n, self.ants) plt.gca().invert_yaxis() self.figure.canvas.draw() ani = animation.FuncAnimation(self.fig, update, frames=self.length, interval=self.interval, repeat=False) plt.gca().invert_yaxis() self.figure.canvas.draw()