From: <and...@ti...> - 2005-03-07 16:55:08
|
Hello Matt & NG, >I get this (fast resizes will eventually crash python though not >immediately) as well with keypress_demo.py, but not with >embedding_in_wx.py or in my own class-based uses of WXAgg: they >resize fine (and quickly) without crashing. It doesn't seem to >be leaking memory, but it seems like it may be something >specific to pylab. I'm not very familiar with pylab, so I'm not >sure of the details. > I am not familiar with pylab too, so I don't know what may be the problem= . >I believe this behavior is common to other backends (the >toggling occurs for me with the TkAgg backend too). I'd guess >that this example hasn't been updated to work with the newer >approaches to pylab being "interactive". Again, I'm not sure of >the right fix, as I'm not familiar enough with the approach that >starts with "from matplotlib.pylab import *" > >The keypress and resizing events work for me with WXAgg on >WinXP. Is it possible to meet your needs by following the >embedding_in_wx.py examples instead of relying on pylab? > I am following the embedding_in_wx.py example. If effect, I never use the= syntaxes: from pylab import import pylab and so on. I just "copied" the embedding_in_wx.py module and I have adapt= ed it for my purposes. This is my import section: from matplotlib import use as matuse matuse('WXAgg') from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Figure= Canvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.figure import Figure Pylab is not there... am I missing something else? Thank you very much for your help. Andrea. |
From: Darren D. <dd...@co...> - 2005-03-07 17:08:17
|
Hi Andrea, On Monday 07 March 2005 11:54 am, and...@ti... wrote: > > I am following the embedding_in_wx.py example. If effect, I never use the > syntaxes: > > from pylab import > import pylab > > and so on. I just "copied" the embedding_in_wx.py module and I have adapted > it for my purposes. This is my import section: > > from matplotlib import use as matuse > matuse('WXAgg') > from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as > FigureCanvas from matplotlib.backends.backend_wx import > NavigationToolbar2Wx > > from matplotlib.figure import Figure > > Pylab is not there... am I missing something else? from pylab import ... is intended for interactive matplotlib plotting sessions or scripting, with syntax very similar to Matlab. To see what it is all about, try http://matplotlib.sourceforge.net/tutorial.html, and http://matplotlib.sourceforge.net/pylab_commands.html The example you are building from is the "Pythonic" object oriented interface, which is more suitable for writing applications than the pylab interface. -- Darren |
From: <and...@ti...> - 2005-03-07 17:15:35
|
Hello Darren & NG, > >from pylab import ... is intended for interactive matplotlib plotting se= ssions >or scripting, with syntax very similar to Matlab. To see what it is all >about, try http://matplotlib.sourceforge.net/tutorial.html, and >http://matplotlib.sourceforge.net/pylab_commands.html > I am not using Matplotlib/Pylab in interactive way. In my RC file the int= eractive option is switched off. >The example you are building from is the "Pythonic" object oriented inte= rface, > >which is more suitable for writing applications than the pylab interface= . I'm sorry, probably I don't catch your point... I used embedding_in_wx.py= because I am trying do embed a Matplotlib figure in a wxPanel on my appli= cation. It seems to me that this is the correct way to go. In my application, I am able to reproduce the strange behavior of the "gr= id" (pushing the "g" button or calling grid(True) doesn't change anything, th= e grid is deleted by Matplotlib). Regarding the examples, either they are not designed to work with Matplot= lib 0.72.1 or there is something strange happening somewhere (my PC? Matplotl= ib?). Andrea. |
From: Darren D. <dd...@co...> - 2005-03-07 17:26:06
|
On Monday 07 March 2005 12:15 pm, and...@ti... wrote: > Hello Darren & NG, > > >from pylab import ... is intended for interactive matplotlib plotting > > sessions or scripting, with syntax very similar to Matlab. To see what it > > is all > > > >about, try http://matplotlib.sourceforge.net/tutorial.html, and > >http://matplotlib.sourceforge.net/pylab_commands.html > > I am not using Matplotlib/Pylab in interactive way. In my RC file the > interactive option is switched off. > [...] > > I'm sorry, probably I don't catch your point... No, I think I did not catch yours. Disregard my last message. -- Darren |
From: Matt N. <new...@ca...> - 2005-03-07 17:34:50
|
Hi Andrea, The pylab interface is generally the non-Class-based approached, suitable for small, procedural scripts. Personally, I'd say this is good for interactive use, 'one-time' scripts, and very simple uses of matplotlib, but that's just my opinion: it seems many people use pylab for more demanding apps. But: you don't need to import pylab at all if you're creating a matplotlib figure in a wxPython (or other) GUI. And, for me at least, toggling the grid and interacting with gui Events work fine. If the embedding_in_wx*.py and the docs aren't enough, you may find it useful to look at the wxPython plotting widget (MPlot) I've been working on. The code is currently at http://cars.uchicago.edu/~newville/Epics/Python/MPlot This provides a simple wxPython Panel (and/or Frame) widget that has simple plot() and oplot() methods. This widget responds to events for zoom, etc and several of the plot attributes (title, labels, line symbol/color,etc) can be altered through the GUI, and you can export plot images and/or use the Printer interface. The documentation is scant but there are a couple examples and a README. I'm intending to improve the functionality and docs and have at least one other person interested and helping out on this. Anyway, feel free to steal from this (that goes for anyone else on the list as well!!). Any suggestions for improvement would be great. Cheers, --Matt |