import  wx
import  wx.lib.plot
import  Numeric

class TestFrame(wx.Frame):
    def __init__(
            self, parent, ID, title, pos=wx.DefaultPosition,
            size=(600, 400), style=wx.DEFAULT_FRAME_STYLE
            ):

        wx.Frame.__init__(self, parent, ID, title, pos, size, style)
 
    def OnCloseWindow(self, event):
        self.Destroy()
 
class TestPanel(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1, size=(600, 400))

        self.client = wx.lib.plot.PlotCanvas(self)

        data1 = 2.*Numeric.pi*Numeric.arange(2*100)/200.
        data1.shape = (100, 2)
        data1[:,1] = Numeric.sin(data1[:,0])
        markers1 = wx.lib.plot.PolyMarker(data1, legend='Green Markers', colour='green', marker='circle',size=1)

    # 50 points cos function, plotted as red line
        data1 = 2.*Numeric.pi*Numeric.arange(2*100)/200.
        data1.shape = (100,2)
        data1[:,1] = Numeric.cos(data1[:,0])
        lines = wx.lib.plot.PolyLine(data1, legend= 'Red Line', colour='red')
        a = wx.lib.plot.PlotGraphics([markers1, lines],"Graph Title", "X Axis", "Y Axis")
        self.client.Draw(a)



def __ptest():

    app = wx.PySimpleApp()
    win = TestFrame(None, -1, "Test FRAME")
    win2 = TestPanel(win)
    win.Show(True)
    app.MainLoop()



if __name__ == '__main__':
    __ptest()
