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
Thanks!
does this also allows the use of the pylab interface? I would like to
use pylab from the command line (in a pycrust shell that i can embed in
a dockable window) and let the figures pop-up in a dockable window too.
But still from the command line use the same commands as i would for
pylab from say ipython.
Regards
Rein
···
On Fri, 2007-06-29 at 10:17 -0500, Matt Newville wrote:
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
But he wants to use pylab in a shell in his wx environment....
JDH
···
On 6/29/07, Matt Newville <newville@...189...> wrote:
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):