It works, and need to add a spline fitting function next.
wx.DC has a nifty spline drawing function, though you may want
something specific. I"d expect there is some coce out there for bezier
splines in numpy.python, though I haven't seen it.
I am not sure if this is a good way to write classes. Please let me know if
there is any suggestion that can make the code clean and easy to read and
follow.
some comments:
* don't use numpy.oldnumeric if you can help it (and you probably
can). And the standard way to import numpy these days is:
import numpy as np
"""data1 = 2.*_Numeric.pi*_Numeric.arange(200)/200.
data1.shape = (100, 2)
data1[:,1] = _Numeric.sin(data1[:,0])
"""
can (and probably should) be written something like:
t = np.linspace(0, np.pi, 100)
data1 = np.column_stack( (t, np.sin(t)) )
* I think I'd keep a PlotGraphics object around in your DrawData
class, and have the various methods modify it, rather than make a new
one each time. That way you can split out axis labeling, etc.
but it generally looks pretty good.
-Chris
···
On Wed, Oct 3, 2012 at 5:27 PM, zhengqing <zhengqinggan@gmail.com> wrote:
Any book about good style of programming?
Regards!
zhengqing(Forrest)
On Wednesday, October 3, 2012 9:26:27 AM UTC-7, Chris Barker wrote:
On Wed, Oct 3, 2012 at 5:36 AM, Benjamin Jessup <b...@abzinc.com> wrote:
> If are not attached to the idea of 'interactive points', you could use
> matplotlib for the plotting, and then use other widgets to edit the data
> (maybe a wx.Grid?). After each edit, you would pass the data to the
> curve
> fit routine, and have the curve fit routine spit out the plot points.
Actually, MPL does support event handling and picking, so you could do
the interactive points with that as well. If you want your plots
pretty and they are standard axes, etc, (i.e want other things MPL
give you) that's probably a good way to go.
Check out:
http://www.youtube.com/watch?v=nCv_MhaeFo8
for a really cool example. (and you can learn a bit about basic
statistics as well)
-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....@noaa.gov
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
--
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