У меня есть файл данных, содержащий координаты x, y фрактала. Я хочу получить анимацию этих координат.
Я пробовал этот код.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
data1=np.loadtxt('data.txt')
fig = plt.figure()
ax = plt.axes()
scat = ax.scatter([], [])
def init():
scat.set_offsets([])
return scat
def animate(i):
scat.set_offsets(data1)
return scat
anim = animation.FuncAnimation(fig, animate, init_func=init,
frames=700, interval=1, blit=True)
plt.show()
Ошибка: объект PathCollection не повторяется.
Я не знаю много, любая помощь будет благодарна.