I want to update a plot in real time. I did some goog search, and saw various
answers. Trouble is, they aren't working.
Here's a typical example:
import matplotlib.pyplot as plt
import numpy as np
fig=plt.figure()
plt.axis([0,1000,0,1])
i=0
x=list()
y=list()
while i 1000:
Dear Neal,
2013/3/11 Neal Becker ndbeck...@gmail.com
I want to update a plot in real time. I did some goog search, and saw
various
answers. Trouble is, they aren't working.
Here's a typical example:
import matplotlib.pyplot as plt
import numpy as np
fig=plt.figure()
Tried with/and without plt.ion(), no difference. Nothing is drawn. When I
kill it with C-c, briefly a window is flashed.
import matplotlib as mpl
import matplotlib.pyplot as plt
plt.ion()
import numpy as np
fig=plt.figure()
plt.axis([0,1000,0,1])
i=0
x=list()
y=list()
while i 1000:
mpl is 1.2.0
Fedora linux
On Mon, Mar 11, 2013 at 9:57 AM, Neal Becker ndbeck...@gmail.com wrote:
Tried with/and without plt.ion(), no difference. Nothing is drawn. When
I kill it with C-c, briefly a window is flashed.
import matplotlib as mpl
import matplotlib.pyplot as plt
plt.ion()
Oops forgot to change the subject line.
On 3/11/13 9:34 AM, David Hoese wrote:
You likely need to show() the canvas. I usually do this by calling
fig.canvas.show() before the for loop.
Since you are using a Qt4 backend the canvas used by the figure is a
QWidget, the basic component of a Qt4
I added fig.canvas.show(). It still does nothing.
If I add
mpl.use ('GTK'), now it seems to be doing realtime plotting.
import matplotlib as mpl
import matplotlib.pyplot as plt
plt.ion()
import numpy as np
fig=plt.figure()
plt.axis([0,1000,0,1])
i=0
x=list()
y=list()
fig.canvas.show()
while i
Someone may have to correct me, but I think this has to do with the Qt4
event loop and it not being run properly. When you get into real time
plotting it can get kind of tricky. In your case (I got the same
results). I have made real-time PyQt4 GUIs before and have always used
separate
I go through a compute loop that takes maybe a few seconds per pass, then
plot a new point on the graph. Do I have to? No - I thought mpl was
supposed to do this and wanted to learn how. If it really doesn't work
I'll do something else.
I don't think animation is correct here - I had the
I agree, I don't think that will work with mpl's animation stuff or at
least I wouldn't want to do it that way. I've created GUIs that received
data from a weather instrument in real-time. I did method 3 that I
mentioned before because I knew the scientists using it were going to
want more and
On 3/11/2013 1:59 PM, Neal Becker wrote:
I go through a compute loop that takes maybe a few seconds per pass, then
plot a new point on the graph.
If you are willing to use TkAgg, see the TSPlot class here:
https://econpy.googlecode.com/svn-history/r175/trunk/abm/gridworld/gridworld.py
Alan
10 matches
Mail list logo