Skip to main content

Posts

Showing posts with the label plotting

Data Plotting in wxPython

wx.lib.plot wxPython has its own plotting library, which provides simple way of drawing large number of data on a canvas. It is convenient to use and it is fast. However you have only one axis per canvas and you can plot 2D graphs only. To plot a line graph like above, you create line objects using numpy Source file 214 x = np . linspace ( 0 , 10 , 500 ) 215 y = np . sin ( x ) 216 217 # create lines 218 line1 = wxplot . PolyLine ( list ( zip ( x , np . sin ( x ))), 219 colour = 'red' , width = 3 , style = wx . PENSTYLE_DOT_DASH ) 220 line2 = wxplot . PolyLine ( list ( zip ( x , - np . sin ( x ))), 221 colour = 'blue' , width = 3 , style = wx . PENSTYLE_LONG_DASH ) Then generate a graphics object and render it on the canvas Source file 223 # create a graphics 224 ...