파이썬 3.5, 윈도우 10 프로.Matplotlib.animation.FuncAnimation using pcolormesh
저는 8x8 픽셀 배열을 계속해서 음모를 꾸미려고합니다. 질문에 대해서는 무작위로 데이터를 사용 하겠지만 실제로는 직렬 포트에서 읽는 중입니다.
while 루프를 사용하여 수행 할 수 있지만 matplotlib.animation.FuncAnimation으로 전환해야하며 작동시킬 수 없습니다. 나는 도움말 파일을 살펴 보았고 matplotlib.org 의 예를 따르려고했지만 그걸 따라갈 수 없었습니다.
누군가가 FuncAnimation과 pcolormesh를 사용하여 8x8 픽셀 배열을 연속적으로 플로팅하는 방법을 알아낼 수 있습니까? 여기에 지금까지있어 무엇 :
import scipy as sp
import matplotlib.pyplot as plt
from matplotlib import animation
plt.close('all')
y = sp.rand(64).reshape([8,8])
def do_something():
y = sp.rand(64).reshape([8,8])
fig_plot.set_data(y)
return fig_plot,
fig1 = plt.figure(1,facecolor = 'w')
plt.clf()
fig_plot = plt.pcolormesh(y)
fig_ani = animation.FuncAnimation(fig1,do_something)
plt.show()
당신은 while 루프 코드를보고 싶다면, 그냥 그렇게 당신은 내가 재현하기 위해 노력하고있어 정확히 알고, 아래를 참조하십시오.
import scipy as sp
import matplotlib.pyplot as plt
plt.figure(1)
plt.clf()
while True:
y = sp.rand(64).reshape([8,8])
plt.pcolormesh(y)
plt.show()
plt.pause(.000001)