def plot_trees(self, rand=None): u""" Draw Graph """ plt.clf() # plt.close() will close the figure window entirely, # where plt.clf() will just clear the figure - you can still paint another plot onto it. if rand is not None: plt.plot(rand.x, rand.y, "^k") for node in self.nodeList: if node.parent is not None: plt.plot(node.path_x, node.path_y, "-b") for (ox, oy, size) in self.obstacleList: plt.plot(ox, oy, "ok", ms=30 * size) dubins_path.marker( self.start.x, self.start.y, self.start.yaw) dubins_path.marker( self.end.x, self.end.y, self.end.yaw) plt.axis([-40, 40, -40, 40]) plt.grid(True) plt.pause(0.01)
def DrawGraph(self, rnd=None): u""" Draw Graph """ plt.clf() if rnd is not None: plt.plot(rnd.x, rnd.y, "^k") for node in self.nodeList: if node.parent is not None: plt.plot(node.path_x, node.path_y, "-g") # plt.plot([node.x, self.nodeList[node.parent].x], [ # node.y, self.nodeList[node.parent].y], "-g") for (ox, oy, size) in self.obstacleList: plt.plot(ox, oy, "ok", ms=30 * size) dubins_path.marker(self.start.x, self.start.y, self.start.yaw) dubins_path.marker(self.end.x, self.end.y, self.end.yaw) plt.axis([-2, 15, -2, 15]) plt.grid(True) plt.pause(0.01)