나 인생에서 iPython에 애니메이션 플롯을 표시 할 수 없다. 이 코드는 matplotlib 애니메이션 예제에서 직접 가져온 것으로 일반 오래된 파이썬 (일명 python animate.py
)을 사용하여 잘 작동합니다. ipython --pylab auto animate.py
와 전화iPython + pylab/matplotlib 애니메이션 기다림
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
fig, ax = plt.subplots()
line, = ax.plot(np.random.rand(10))
ax.set_ylim(0, 1)
def update(data):
line.set_ydata(data)
return line,
def data_gen():
while True: yield np.random.rand(10)
ani = animation.FuncAnimation(fig, update, data_gen, interval=100)
#plt.ion()
plt.show()
#while 1:
#plt.draw()
, ipython --pylab tk animate.py
모두 윈도우가 즉시 사라지는 원인이된다. ion()
및 plt.draw()
의 주석을 제거하면 프레임 하나가 그려지고 중단됩니다. iPython은 일반적인 matplotlib 구현보다 스레드로부터 안전하기 때문에 사용해야합니다.
내가 뭘 잘못하고 있니? iPython 1.1 OSX 10.8에 python2.7.2를 사용하여 1.3
안녕하세요, 스티브, - pylab 스위치를 사용하지 않으면, (afaik 어쨌든) 사용에 관심이있는 ipython 백엔드를 활성화하지 않습니다. – jeremy