Как передать аргументы функции animation()? , Я пробовал, но сработал. прототип animation.FuncAnimation() являетсяПередача аргументов в анимации.FuncAnimation()
класс matplotlib.animation.FuncAnimation (рис, FUNC, кадры = нет, init_func = None, fargs = нет, save_count = нет, ** kwargs) Основы: Matplotlib. анимация.TimedAnimation
Я наклеил код ниже, какие изменения мне нужно сделать?
import matplotlib.pyplot as plt
import matplotlib.animation as animation
def animate(i,argu):
print argu
graph_data = open('example.txt','r').read()
lines = graph_data.split('\n')
xs = []
ys = []
for line in lines:
if len(line) > 1:
x, y = line.split(',')
xs.append(x)
ys.append(y)
ax1.clear()
ax1.plot(xs, ys)
plt.grid()
ani = animation.FuncAnimation(fig,animate,fargs = 5,interval = 100)
plt.show()
Можете ли вы объяснить, что «не работает»? Получили ли вы ответ? – tacaswell