-4
실시간으로 데이터를 플롯하는 응용 프로그램을 구현하려고합니다. this question에서 찾은 일부 코드를 시도했지만 작동하지 않습니다. 이 그림은 for
루프 이전의 결과와 for
루프가 수행 된 결과 중 하나를 나타냅니다.파이썬/파이 트에서 대화 형 실시간 플로팅
이것은 파이썬 인터프리터에서 우분투에서 실행됩니다.
내가 말하는 겁니다 코드 :
import numpy as np
import matplotlib.pyplot as plt
plt.ion()
mu, sigma = 100, 15
fig = plt.figure()
x = mu + sigma*np.random.randn(10000)
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='green', alpha=0.75)
for i in range(50):
x = mu + sigma*np.random.randn(10000)
n, bins = np.histogram(x, bins, normed=True)
for rect,h in zip(patches,n):
rect.set_height(h)
fig.canvas.draw()