Hello everyone:
I want to display a array realtime by matplotlib, but It seems there are
some errors. Let me explain it in detail:
At first creat a array, then change the data every other 2 seconds, at
the same time plot the picture every other 2 seconds, the data of picture is
from the array.
import numpy as np import matplotlib.pyplot as plt import
time xx=np.zeros([2,10]) for i in range(10):
xx[0,i-1]=5*i xx[1,i-1]=i
a=xx[0,:] b=xx[1,:] print
xx plt.figure(figsize=(8,4))
plt.plot(a,b,label="$picture$",color="red",linewidth=2)
plt.legend() plt.show()
time.sleep(2)
Does anyone who can help me? Thank you very much!
Best wishes,
=========================================== Yan Fen Shanghai
Synchrotron Radiation Facility Shanghai Institute of Applied
Physics Chinese Academy of Sciences Zhangheng Rd 239,Pudong
Dist., Shanghai
201204 China Tel:+86-21-33933225 ====================================
|