The problem: I have files with time versus signal data of a large series of measurements. The python application (using wxPython actually) scans the file, applies some math (numpy/scipy) on each record of data and than must show the signal as a plot. After clicking OK the next record of measurement data is processed and shown. So I do need some construct that allows showing a series of figure one after the other. My solution works ok but I would think that there should be an elegant shortcut that directly scales the mathplotlib figure to a bitmap that can be shown. Does that better explain the purpose of my question? Cheers,Janwillem
Janwillem wrote: > > I have an application where I would like to use show in a loop but as > stated in 18.1 of the manual that does not work. > # WARNING : illustrating how NOT to use show > for i in range(10): > # make figure i > show() > So I made a workaround in a custom wxDialog with a wxStaticBitmap and a > few buttons and put the matplotlib figure in the bitmap with something > like: > wi,hi = figure.get_size_inches() > width,height = bitmap_plot.GetSize() > dpi = int(min(width/wi,height/hi)) > figure.savefig('/tmp/tmp.png',dpi = dpi) > image = wx.Image('/tmp/tmp.png',wx.BITMAP_TYPE_ANY) > bitmap = wx.BitmapFromImage(image) > bitmap_plot.SetBitmap(bitmap) > Thus scaling the figure using the dpi option of savefig and then loading > it into the wxStaticBitmap. > > To me it seems there might be a lot of unnecessary data handling. What is > the clever solution? > mant thanks > -- View this message in context: http://www.nabble.com/show-figures-in-a-loop-tp24776045p24777765.html Sent from the matplotlib - users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users