【发布时间】:2018-06-20 03:31:12
【问题描述】:
我目前正在使用 matplotlib 的 FuncAnimation 函数,遇到了一个问题。我的代码遵循与下面代码类似的逻辑
import matplotlib.animation as animation
import matplotlib.pyplot as plt
class Example:
def __init__(self):
self.fig = plt.figure()
def update(self, num):
print("This is getting called")
def animate(self):
ani = animation.FuncAnimation(self.fig, update, interval=100)
def main():
obj = Example()
obj.animate()
if __name__ == "__main__":
main()
目前,我的代码没有打印出“这正在被调用”。我尝试传入 self.update 而不是 update 到 FuncAnimation,但无济于事。我还尝试在调用 FuncAnimation 之前编写全局更新,这也不起作用。我想知道是否有人可以帮助我。
【问题讨论】:
标签: python class matplotlib parameters rules