I suspect ANY code that tried to plot each pixel with a python
function call is going to be slow.
wx.DC has a DrawPointList(), which could be a great deal faster:
Draw a list of points as quickly as possible.
:param points: A sequence of 2-element sequences representing
each point to draw, (x,y).
:param pens: If None, then the current pen is used. If a
single pen then it will be used for all points. If
a list of pens then there should be one for each point
in points.
though if you have thousands, that means you'll need thousands of
wx.Pens -- not sure if that will be an issue.
FloatCanvas uses DrawPointList for the FC.PointSet DrawObject, so it's
about as fast as it could be. But it only supports every piunt being
the same color. however, it wouldn't be too hard to create a new
version that gives a separate color per point.
There is also this:
http://trac.paulmcnett.com/floatcanvas/wiki/SmoothLines
Which shows you how to use wx.GraphicsContext with floatCanvas to draw
lines with gradient colors -- unfortunately, GraphicsContext doesn't
directly support that, so it's kludged with a narrow polygon.
If you really need top performance, PyOpenGL will do it -- but with a
lot more complex code to write...
-Chris
···
On Thu, Aug 23, 2012 at 5:06 PM, zhengqing <zhengqinggan@gmail.com> wrote:
Hi Chris,
Thank you for you help.
And in the code, I use the PolyLine to get this color diagram. But the
ultimate goal is to plot this color diagram with plotpoints, which means
draw each pixcel with the correct color. I am not sure how to do it now, I
tryied as I posted the first time, but it is slow.
--
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