Jay Parlar wrote:
Our first run at it was using matplotlib with wx, but the update was
horrendous (roughly 2 fps).
hmm. MPL is pretty slow, but that's worse than it should be. Were you
using wxAgg or plain wx?
def Draw(self, DC):
DC = wx.PaintDC(self)
DC.SetBackground(wx.Brush("White"))
DC.Clear()GC = wx.GraphicsContext.Create(DC)
GraphicsContext is pretty slow (though it shouldn't be on OS-X). Have
you tried a regular old DC?
I update self.points in the event handler, and it will always consist
of 500 (X,Y) tuples. So essentially, I'm trying to draw a 500 point
line 20 times per second.
That should be totally doable.
Is this the best way to do this? Anyone have any hints for going
faster, and using less CPU?
try a plain DC.
If you want fancier features, you could try wx.lib.floatcanvas. It uses
a plain old DC for drawing, and can easily do 20Hz for a 500 point line.
It also uses numpy which can be wonderful for this kind of thing.
For more info on FloatCanvas:
http://morticia.cs.dal.ca/FloatCanvas/
There are a bunch of additional demos in SVN (and the latest release).
Check out the MovingPlot.py demo.
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov