【发布时间】:2014-08-28 04:57:09
【问题描述】:
我正在尝试为等高线图制作动画。以下示例与我想要实现的目标足够接近(来自this archive):
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0, 2 * np.pi, 0.1)
X,Y = np.meshgrid(x,x)
f1 = np.sin(X) + np.sin(Y)
f2 = np.cos(X) + np.cos(Y)
plt.figure()
C = plt.contourf(f1)
plt.show()
for coll in C.collections:
plt.gca().collections.remove(coll)
C = plt.contourf(f2)
plt.draw()
但是,remove 命令似乎存在问题,我不确定如何解决。
【问题讨论】:
-
有什么问题?你能指望什么?会发生什么?
标签: python animation matplotlib