Я пытаюсь построить линию, и у меня есть три точки для нее, которые находятся в двух списках: x, y.
Код работает, но я не вижу линии, которая отображается передо мной, и, следовательно, она выглядит как изображение. Как мне замедлить эту анимацию?
Вот код:
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
fig = plt.figure()
ax = plt.axes(xlim=(0, 105), ylim=(0, 68))
line, = ax.plot([], [], lw=2)
def init():
line.set_data([], [])
return line,
def animate(i):
x = np.array([23.94, 34.65, 28.14])
y = np.array([5.984, 6.664, 6.256])
#x = np.linspace(0, 2, 1000)
#y = np.sin(2 * np.pi * (x - 0.01 * i))
line.set_data(x, y)
return line,
anim = animation.FuncAnimation(fig, animate, init_func=init,
frames=1, interval=1, save_count = 50, blit=True)
FFWriter = animation.FFMpegWriter()
#ani.save('particle_box.avi', writer = FFWriter)
#anim.save('basic.mp4', writer = FFWriter)#, fps=30)#, extra_args=['-vcodec', 'libx264'])
plt.show()