2004-01-12 22:17:17 -05:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
#
|
2004-01-12 22:17:17 -05:00
|
|
|
# wx.lib.wxPlotCanvas is deprecated. Use wx.lib.plot instead.
|
2003-12-08 20:23:28 -05:00
|
|
|
#
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
import wx
|
|
|
|
import wx.lib.wxPlotCanvas as plot
|
|
|
|
|
|
|
|
import Numeric
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
def _InitObjects():
|
|
|
|
# 100 points sin function, plotted as green circles
|
|
|
|
data1 = 2.*Numeric.pi*Numeric.arange(200)/200.
|
|
|
|
data1.shape = (100, 2)
|
|
|
|
data1[:,1] = Numeric.sin(data1[:,0])
|
2003-12-08 20:23:28 -05:00
|
|
|
markers1 = plot.PolyMarker(data1, color='green', marker='circle',size=1)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
# 50 points cos function, plotted as red line
|
|
|
|
data1 = 2.*Numeric.pi*Numeric.arange(100)/100.
|
|
|
|
data1.shape = (50,2)
|
|
|
|
data1[:,1] = Numeric.cos(data1[:,0])
|
2003-12-08 20:23:28 -05:00
|
|
|
lines = plot.PolyLine(data1, color='red')
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
# A few more points...
|
|
|
|
pi = Numeric.pi
|
2003-12-08 20:23:28 -05:00
|
|
|
markers2 = plot.PolyMarker([(0., 0.), (pi/4., 1.), (pi/2, 0.),
|
1999-04-29 23:29:54 -04:00
|
|
|
(3.*pi/4., -1)], color='blue',
|
|
|
|
fillcolor='green', marker='cross')
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
return plot.PlotGraphics([markers1, lines, markers2])
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
2003-12-08 20:23:28 -05:00
|
|
|
win = plot.PlotCanvas(nb)
|
1999-04-29 23:29:54 -04:00
|
|
|
win.draw(_InitObjects(),'automatic','automatic');
|
|
|
|
return win
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
overview = plot.__doc__
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
2003-07-02 19:13:10 -04:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
|
|
|
run.main(['', os.path.basename(sys.argv[0])])
|