From: Matt N. <new...@ca...> - 2007-06-29 15:17:30
|
Rein, I don't think you need to change the wx backend to make a MPL plot appear in a dockable pane. You can definitely create a wx.Panel and put a MPL Figure in it such as (untested code): <untested code snippet> import wx import matplotlib from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg from matplotlib.figure import Figure class MyPlotPanel(wx.Panel): def __init__(self, parent, **kw): wx.Panel.__init__(self, parent, -1, **kw) self.fig = Figure(self,(6.0,4.0), dpi=96) self.axes = self.fig.add_axes([0.15,0.15,0.75,0.75]) self.canvas = FigureCanvasWxAgg(self,-1, self.fig) </untested code snippet> and then use self.axes.plot() (or other methods) and canvas.draw(). Of course, you'll have to put that Panel someplace. I haven't tried to make a plot in a dockable window myself, but I'd be surprised if you couldn't do it. Take a look at wxmpl http://agni.phys.iit.edu/~kmcivor/wxmpl/ and/or my own PlotPanel code from MPlot: http://cars9.uchicago.edu/~newville/Python/MPlot/ and/or read http://www.scipy.org/Cookbook/Matplotlib/EmbeddingInWx for more hints and examples. Cheers, --Matt Newville |