def draw_points_animation(points, path): import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation x = [point[0] for point in points] y = [point[1] for point in points] fig, ax = plt.subplots() line, = ax.plot([], [], 'r-') def animate(i): lin