Hello Yan,
please have a look at http://matplotlib.sourceforge.net/examples/index.html. You can find there new and old matplotlib animation examples. The main problem with your code is that you invoke the show() recurrently.
Best regards
Juraj
-----Original Message-----
From: [email protected] on behalf of ??
Sent: Wed 11/30/2011 9:29 AM
To: [email protected]
Subject: About matplotlib draw picture
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
====================================
- References:
- About matplotlib draw picture 闫芬
- Navigate by Date:
- Prev:
About matplotlib draw picture 闫芬
- Next:
Re: [help] degree in Computer Science/Software Engineering Dirk Zimoch
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
About matplotlib draw picture 闫芬
- Next:
UPDATE: CA Lab 32/64 Bit (interface between LabVIEW and EPICS) Carsten Winkler
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|