有没有一种创建动画图表的方法。例如显示具有不同参数的相同图表。
比如是SAGE notebook,可以这样写:
a = animate([circle((i,i), 1-1/(i+1), hue=i/10) for i in srange(0,2,0.2)],
xmin=0,ymin=0,xmax=2,ymax=2,figsize=[2,2])
a.show()
最佳答案
这有可怕的闪烁,但至少这为我创造了一个动画情节。它基于 Aron's,但 Aron's 不能按原样工作。
import time, sys
from IPython.core.display import clear_output
f, ax = plt.subplots()
n = 30
x = array([i/10.0 for i in range(n)])
y = array([sin(i) for i in x])
for i in range(5,n):
ax.plot(x[:i],y[:i])
time.sleep(0.1)
clear_output()
display(f)
ax.cla() # turn this off if you'd like to "build up" plots
plt.close()
关于plot - ipython notebook 中的动画图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11611705/