Hi, 2007/10/29, Darran Edmundson <[EMAIL PROTECTED]>: > > I'm trying to generate plots as textures for use within a real-time > graphics application (written using the pythonOgre graphics engine). > I'm brand new to matplotlib so please bear with me. Two questions, one > easy, one possibly hard. > > In the following code snippet, I create and draw a pie chart, do some > intermediate work, update the pie fractions, and redraw. I end up with > the second version superimposed on the first. Initially I thought it > was simply a matter of clearing the canvas, but as I repeat this test > with more and more updates, the redraw seems to slow down - this makes > me think that each redraw is actually rerendering all the layers. Is > this the case? If so, how do I avoid it? > > # create matplotlib figure > figure = Figure(figsize=(4,3), dpi=200, frameon=True) > figureCanvas = FigureCanvas(figure) > > # unchanging details of pie chart > ax = figure.add_subplot(111) # pie plot > labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' > ax.set_title('Example pyOgre Pie Chart') > ax.grid(True) > ax.pie([25,25,30,20], labels=labels) > figureCanvas.draw() > > # .... > > # update pie chart
At this point I guess you can do ax.clear() to clear the axis and delete all the old plots. > ax.pie([30,25,25,20], labels=labels) > > # matplotlib draw > figureCanvas.draw() > > > > And the harder question. I need access to the address of the raw image > buffer. (I assume this is a contiguous block of c-allocated memory?) > Presently, I copy into a ctypes buffer but this slows things down > significantly. Is there an alternative approach? Sorry I can't help with this :-/. Regards, ~ Antonio ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users