]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxPlotCanvas.py
Compatibility modules for a couple that have gone AWOL in the new namespace
[wxWidgets.git] / wxPython / demo / wxPlotCanvas.py
1 # 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2 #
3 # o Updated for wx namespace
4 #
5 # 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
6 #
7 # o wxPlotCanvas must be updated with new draw mechanics (tuples) before
8 # it can be used with 2.5.
9 #
10
11 import wx
12 import wx.lib.wxPlotCanvas as plot
13
14 import Numeric
15
16 #---------------------------------------------------------------------------
17
18 def _InitObjects():
19 # 100 points sin function, plotted as green circles
20 data1 = 2.*Numeric.pi*Numeric.arange(200)/200.
21 data1.shape = (100, 2)
22 data1[:,1] = Numeric.sin(data1[:,0])
23 markers1 = plot.PolyMarker(data1, color='green', marker='circle',size=1)
24
25 # 50 points cos function, plotted as red line
26 data1 = 2.*Numeric.pi*Numeric.arange(100)/100.
27 data1.shape = (50,2)
28 data1[:,1] = Numeric.cos(data1[:,0])
29 lines = plot.PolyLine(data1, color='red')
30
31 # A few more points...
32 pi = Numeric.pi
33 markers2 = plot.PolyMarker([(0., 0.), (pi/4., 1.), (pi/2, 0.),
34 (3.*pi/4., -1)], color='blue',
35 fillcolor='green', marker='cross')
36
37 return plot.PlotGraphics([markers1, lines, markers2])
38
39
40 #---------------------------------------------------------------------------
41
42
43 def runTest(frame, nb, log):
44 win = plot.PlotCanvas(nb)
45 win.draw(_InitObjects(),'automatic','automatic');
46 return win
47
48 overview = plot.__doc__
49
50 #---------------------------------------------------------------------------
51
52
53 if __name__ == '__main__':
54 import sys,os
55 import run
56 run.main(['', os.path.basename(sys.argv[0])])