【发布时间】:2021-01-03 03:34:42
【问题描述】:
我对 matplotlib 的 Animate 函数有一些问题。 这里的代码:它给了我一个空图。也许我需要下载其他一些模块?
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import matplotlib.animation as animation
x_data = []
y_data = []
fig, ax = plt.subplots()
ax.set_xlim(0, 105)
ax.set_ylim(0, 12)
line, = ax.plot(0, 0)
def animation_frame(i):
x_data.append(i*10)
y_data.append(i)
line.set_x_data(x_data)
line.set_y_data(y_data)
return line,
ani = animation.FuncAnimantion(fig, func = animation_frame, frames = np.arange(0, 10, 0.01), interval = 10)
plt.show()
输出是:
File "C:\Users\Utente\untitled0.py", line 28, in <module>
ani = animation.FuncAnimantion (fig,func= animation_frame,frames=np.arange(0,10,0.01),interval=10)
*****AttributeError: module 'matplotlib.animation' has no attribute 'FuncAnimantion'*****
有一个空图!
有人可以帮助我吗?
【问题讨论】:
-
如果这解决了您的问题,请考虑接受答案
标签: python matplotlib