Hi All:
I'm very new to matplotlib, but it seems like a very powerful tool!
I'm trying to write a wxpython GUI that displays an image from a data
file that the user selected. I've looked at a bunch of examples, but
can't seem to get it quite right. I've initialized the image to a
buffer of zeros, but can never get it to display the new data!
Any/all help & suggestions are greatly appreciated!!!
I wrote a "setupPlot" method that is called in the init method of a
wx.ScrolledWindow:
def SetupPlot(self):
self.figure = Figure()
self.axes = self.figure.add_subplot(111)
self.data = np.zeros((64,8800),float)
self.myImage = self.axes.imshow(self.data,aspect=100,animated=True)
self.canvas = FigureCanvas(self, -1, self.figure)
self.sizer.Add(self.canvas,pos=(1,1))
self.add_toolbar()
Here is my "onPaint" event:
def OnPaint(self, event):
self.canvas.draw()
Finally, here is my "openFile" event:
def OnOpenFileEvent(self,event):
dlg = wx.FileDialog(self,"Open Channel data
file...",os.getcwd(), style=wx.OPEN,wildcard=self.wildcard)
if dlg.ShowModal() == wx.ID_OK:
self.filename = dlg.GetPath()
datatype = np.complex64
shape = (64,8800)
fd = open(self.filename, 'rb')
read_data = np.fromfile(file=fd,
dtype=datatype).reshape(shape)
x = abs(fftshift(read_data))
self.myImage.set_array(x)
self.axes.draw_artist(self.myImage)
self.canvas.blit()
THANXS
amb
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users