]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxPlotCanvas.py
Updates for recent changes to wx, and some other little tweaks and fixes.
[wxWidgets.git] / wxPython / demo / wxPlotCanvas.py
1
2 from wxPython.lib.wxPlotCanvas import *
3 from wxPython.lib import wxPlotCanvas
4
5 #---------------------------------------------------------------------------
6
7 def _InitObjects():
8 # 100 points sin function, plotted as green circles
9 data1 = 2.*Numeric.pi*Numeric.arange(200)/200.
10 data1.shape = (100, 2)
11 data1[:,1] = Numeric.sin(data1[:,0])
12 markers1 = PolyMarker(data1, color='green', marker='circle',size=1)
13
14 # 50 points cos function, plotted as red line
15 data1 = 2.*Numeric.pi*Numeric.arange(100)/100.
16 data1.shape = (50,2)
17 data1[:,1] = Numeric.cos(data1[:,0])
18 lines = PolyLine(data1, color='red')
19
20 # A few more points...
21 pi = Numeric.pi
22 markers2 = PolyMarker([(0., 0.), (pi/4., 1.), (pi/2, 0.),
23 (3.*pi/4., -1)], color='blue',
24 fillcolor='green', marker='cross')
25
26 return PlotGraphics([markers1, lines, markers2])
27
28
29 #---------------------------------------------------------------------------
30
31
32 def runTest(frame, nb, log):
33 win = PlotCanvas(nb)
34 win.draw(_InitObjects(),'automatic','automatic');
35 return win
36
37 overview = wxPlotCanvas.__doc__
38
39 #---------------------------------------------------------------------------