]>
Commit | Line | Data |
---|---|---|
95bfd958 | 1 | |
8fa876ca | 2 | # |
95bfd958 | 3 | # wx.lib.wxPlotCanvas is deprecated. Use wx.lib.plot instead. |
8fa876ca | 4 | # |
cf694132 | 5 | |
8fa876ca RD |
6 | import wx |
7 | import wx.lib.wxPlotCanvas as plot | |
8 | ||
9 | import Numeric | |
cf694132 RD |
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]) | |
8fa876ca | 18 | markers1 = plot.PolyMarker(data1, color='green', marker='circle',size=1) |
cf694132 RD |
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]) | |
8fa876ca | 24 | lines = plot.PolyLine(data1, color='red') |
cf694132 RD |
25 | |
26 | # A few more points... | |
27 | pi = Numeric.pi | |
8fa876ca | 28 | markers2 = plot.PolyMarker([(0., 0.), (pi/4., 1.), (pi/2, 0.), |
cf694132 RD |
29 | (3.*pi/4., -1)], color='blue', |
30 | fillcolor='green', marker='cross') | |
31 | ||
8fa876ca | 32 | return plot.PlotGraphics([markers1, lines, markers2]) |
cf694132 RD |
33 | |
34 | ||
35 | #--------------------------------------------------------------------------- | |
36 | ||
37 | ||
38 | def runTest(frame, nb, log): | |
8fa876ca | 39 | win = plot.PlotCanvas(nb) |
cf694132 RD |
40 | win.draw(_InitObjects(),'automatic','automatic'); |
41 | return win | |
42 | ||
8fa876ca | 43 | overview = plot.__doc__ |
cf694132 RD |
44 | |
45 | #--------------------------------------------------------------------------- | |
1fded56b RD |
46 | |
47 | ||
1fded56b RD |
48 | if __name__ == '__main__': |
49 | import sys,os | |
50 | import run | |
8eca4fef | 51 | run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:]) |