]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/PlotCanvas.py
Added config checks for wxUSE_IMAGE = 0.
[wxWidgets.git] / wxPython / demo / PlotCanvas.py
1
2 #
3 # wx.lib.wxPlotCanvas is deprecated. Use wx.lib.plot instead.
4 #
5
6 import wx
7 import wx.lib.wxPlotCanvas as plot
8
9 import Numeric
10
11 #---------------------------------------------------------------------------
12
13 def _InitObjects():
14 # 100 points sin function, plotted as green circles
15 data1 = 2.*Numeric.pi*Numeric.arange(200)/200.
16 data1.shape = (100, 2)
17 data1[:,1] = Numeric.sin(data1[:,0])
18 markers1 = plot.PolyMarker(data1, color='green', marker='circle',size=1)
19
20 # 50 points cos function, plotted as red line
21 data1 = 2.*Numeric.pi*Numeric.arange(100)/100.
22 data1.shape = (50,2)
23 data1[:,1] = Numeric.cos(data1[:,0])
24 lines = plot.PolyLine(data1, color='red')
25
26 # A few more points...
27 pi = Numeric.pi
28 markers2 = plot.PolyMarker([(0., 0.), (pi/4., 1.), (pi/2, 0.),
29 (3.*pi/4., -1)], color='blue',
30 fillcolor='green', marker='cross')
31
32 return plot.PlotGraphics([markers1, lines, markers2])
33
34
35 #---------------------------------------------------------------------------
36
37
38 def runTest(frame, nb, log):
39 win = plot.PlotCanvas(nb)
40 win.draw(_InitObjects(),'automatic','automatic');
41 return win
42
43 overview = plot.__doc__
44
45 #---------------------------------------------------------------------------
46
47
48 if __name__ == '__main__':
49 import sys,os
50 import run
51 run.main(['', os.path.basename(sys.argv[0])])