From: Rein v. d. B. <re...@sc...> - 2007-06-29 14:39:41
|
> On 6/29/07, Rein van den Boomgaard <re...@sc...> wrote: > > thanks for answering. I have seen the examples using the oo mpl api, > but > > i would like to use the pylab interface from the shell i'm using > (also > > in the wx GUI). I'm aiming at a very simplified matlab like > interface > > where the plots apear in the dockable windows. > > You will probably need to write your own modified backend based on > backend_wx and backend_wxagg, that replaces the new_figure_manager and > FigureManager code with some custom functionality to use your panes. > > OK that is the file that i looked into already. Is the backend functionality i need really concentrated in only these files? (amazing..) I'll give it a try. BTW is there a design document to get some grasp on the architecture of matplotlib / pylab? It seems that most documentation concentrates on describing pylab. Probably most people are using pylab (as i do most of the time...). Regards Rein |
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 |
From: Rein v. d. B. <re...@sc...> - 2007-06-29 15:23:15
|
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 |
From: John H. <jd...@gm...> - 2007-06-29 15:25:53
|
On 6/29/07, Matt Newville <new...@ca...> 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): But he wants to use pylab in a shell in his wx environment.... JDH |
From: John H. <jd...@gm...> - 2007-06-29 14:47:47
|
On 6/29/07, Rein van den Boomgaard <re...@sc...> wrote: > OK that is the file that i looked into already. Is the backend > functionality i need really concentrated in only these files? > (amazing..) pretty much - - there is a pretty tight segregation between the figure and the gui. > BTW is there a design document to get some grasp on the architecture of > matplotlib / pylab? It seems that most documentation concentrates on > describing pylab. Probably most people are using pylab (as i do most of > the time...). backend_template.py and backend_bases.py are good starting points. There is a chapter in the user's guide and some resources at http://matplotlib.sourceforge.net/faq.html#OO JDH > > Regards > Rein > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |