]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/PlotCanvas.py
1 # 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
3 # o Updated for wx namespace
5 # 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
7 # o wxPlotCanvas must be updated with new draw mechanics (tuples) before
8 # it can be used with 2.5.
12 import wx
.lib
.wxPlotCanvas
as plot
16 #---------------------------------------------------------------------------
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)
25 # 50 points cos function, plotted as red line
26 data1
= 2.*Numeric
.pi
*Numeric
.arange(100)/100.
28 data1
[:,1] = Numeric
.cos(data1
[:,0])
29 lines
= plot
.PolyLine(data1
, color
='red')
31 # A few more points...
33 markers2
= plot
.PolyMarker([(0., 0.), (pi
/4., 1.), (pi
/2, 0.),
34 (3.*pi
/4., -1)], color
='blue',
35 fillcolor
='green', marker
='cross')
37 return plot
.PlotGraphics([markers1
, lines
, markers2
])
40 #---------------------------------------------------------------------------
43 def runTest(frame
, nb
, log
):
44 win
= plot
.PlotCanvas(nb
)
45 win
.draw(_InitObjects(),'automatic','automatic');
48 overview
= plot
.__doc
__
50 #---------------------------------------------------------------------------
53 if __name__
== '__main__':
56 run
.main(['', os
.path
.basename(sys
.argv
[0])])