Re: [Matplotlib-users] Nonblocking Plots with Matplotlib
Bill, very cool. Also, thanks for showing me how Twisted can be used like Pyro, more-or-less, I think. (If I understand your code from my 1 minute perusal.) On Mac OS X, there's one issue I don't have time to follow any further: sys.executable points to /Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/MacOS/Python whereas /Library/Frameworks/Python.framework/Versions/Current/bin/python is the file actually on my path. For some reason, when I run the latter ezplot is found, when the former, it is not. Thus, your auto-spawning of a plotserver instance fails on my installation. Other than that, the example you gave works as advertised and looks great. (Ohh, those anti-aliased lines look better and better the more I suffer through my colleagues' aliased plots...) Bill Baxter wrote: Howdy Folks, I was missing the good ole days of using Matlab back at the Uni when I could debug my code, stop at breakpoints and plot various data without fear of blocking the interpreter process. Using ipython -pylab is what has been suggested to me in the past, but the problem is I don't do my debugging from ipython. I have a very nice IDE that works very well, and it has a lovely interactive debugging prompt that I can use to probe my code when stopped at a breakpoint. It's great except I can't really use matplotlib for debugging there because it causes things to freeze up. So I've come up with a decent (though not perfect) solution for quickie interactive plots which is to run matplotlib in a separate process. I call the result it 'ezplot'. The first alpha version of this is now available at the Cheeseshop. (I made an egg too, so if you have setuptools you can do easy_install ezplot.) The basic usage is like so: In [1]: import ezplot In [2]: p = ezplot.Plotter() In [3]: p.plot([1,2,3],[1,4,9],marker='o') Connecting to server... waiting... connected to plotserver 0.1.0a1 on http://localhost:8397 Out[3]: True In [4]: from numpy import * In [5]: x = linspace(-5,5,20) In [13]: p.clf() Out[13]: True In [14]: p.plot(x, x*x*log(x*x+0.01)) (Imagine lovely plots popping up on your screen as these commands are typed.) The only return values you get back are True (success...probably) or False (failure...for sure). So no fancy plot object manipulation is possible. But you can do basic plots no problem. The nice part is that this (unlike ipython's built-in -pylab threading mojo) should work just as well from wherever you're using python. Whether it's ipython (no -pylab) or Idle, or a plain MS-DOS console, or WingIDE's debug probe, or SPE, or a PyCrust shell or whatever. It doesn't matter because all the client is doing is packing up data and shipping over a socket. All the GUI plotting mojo happens in a completely separate process. There are plenty of ways this could be made better, but for me, for now, this probably does pretty much all I need, so it's back to Real Work. But if anyone is interested in making improvements to this, let me know. Here's a short list of things that could be improved: * Right now I assume use of the wxAGG backend for matplotlib. Don't know how much work it would be to support other back ends (or how to go about it, really). wxAGG is what I always use. * Returning more error/exception info from the server would be nice * Returning full fledged proxy plot objects would be nice too, but I suspect that's a huge effort * SOAP may be better for this than xmlrpclib but I just couldn't get it to work (SOAPpy + Twisted). * A little more safety would be nice. Anyone know how to make a Twisted xmlrpc server not accept connections from anywhere except localhost? * There's a little glitch in that the spawned plot server dies with the parent that created it. Maybe there's a flag to subprocess.Popen to fix that? * Sometimes when you click on Exit Server, if there are plot windows open it hangs while shutting down. Only tested on Win32 but there's nothing much platform specific in there. Give it a try and let me know what you think! --bb - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash
[Matplotlib-users] No undershoot in hist
Hello, thanks for the quick reply to my last problem. Here I've got a new one: While the last bin carries the overshoot, the first bin does not carry the undershoot. Example: from numpy import * from pylab import * bins = 2 + arange(21) data = arange(24) print bins print data hist(data,bins) show() The last bin has two counts since it contains the entries 22 and 23 from data, but the first bin has only one count, although it should carry the entries 0,1,2. Is this intended? Best regards, Peter Melchior - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Question about imshow and matshow
Hello everybody, when using matplotlib, any plot I create is displayed separately from my Tkinter application. Is there a direct way to embed the plot created by matplotlib in a widget such as a canvas using something like create_image or something else ? Currently, the only thing I managed to do is: -create my plot with matshow -save the figure using savefig (png) -embed the png in a canvas using create_image not very smart, isn't it ? Thank you very much best regards Eric Pellegrini - Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] memory problem
Hi, I have a memory problem. I'm using: matplotlib-0.85, python 2.3.5, gtk 2.8.6 and pygtk 2.8.2. I create a FigureCanvasGTKAgg with a subplot and I add one Line2D to this subplot. Then I add this FigureCanvas in a gtk.Window When I destroy the gtk.Window (by the gtk method destroy), the memory seem to be not released. Even if I clear the subplot before destroy the gtk.window only a part of memory is released. Am I missing something obvious? Can somebody help me? Thanks marco - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Question about imshow and matshow
On 3/15/07, Pellegrini Eric [EMAIL PROTECTED] wrote: Hello everybody, when using matplotlib, any plot I create is displayed separately from my Tkinter application. Is there a direct way to embed the plot created by matplotlib in a widget such as a canvas using something like create_image or something else ? Currently, the only thing I managed to do is: -create my plot with matshow -save the figure using savefig (png) -embed the png in a canvas using create_image not very smart, isn't it ? Definitely not ;). It's simple to embed matplotlib in the common toolkits. Download the examples tarball from the matplotlib site and look at the files embedding_in_XXX.py. There are examples for tk, gtk, qt and wx toolkits. Thank you very much best regards Eric Pellegrini ~ Antonio - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] pylab vs. embedding in wx
I have a problem that probably highlights a problem with how I normally use mpl vs. how I should use it. I have some utility scripts that do various data processing tasks and also have convenience functions for plotting data using pylab. Almost all of my scripts have a line like this near the top: from pylab import figure, cla, clf, plot, subplot, show, ylabel, xlabel, xlim, ylim, semilogx, legend, title, savefig I am now trying to import some of my data processing functions into a script that is embedding matplotib in a wxPython application following the embedding_in_wx#.py examples. I am getting this error: [EMAIL PROTECTED]:~/siue/Research/PythonSimulationEnvironment$ python SystemID_gui.py Traceback (most recent call last): File SystemID_gui.py, line 18, in ? import rwkbode File /home/ryan/pythonutil/rwkbode/__init__.py, line 3, in ? import pylab File /usr/lib/python2.4/site-packages/pylab.py, line 1, in ? from matplotlib.pylab import * File /usr/lib/python2.4/site-packages/matplotlib/pylab.py, line 216, in ? from backends import new_figure_manager, draw_if_interactive, show ImportError: cannot import name new_figure_manager which seems to say that pylab cannot be imported after my wx mpl panel has done this: import matplotlib import wx from scipy import sin, cos, pi, atleast_1d, shape, log10 #from wxPython.wx import * matplotlib.use('WXAgg') import matplotlib.cm as cm from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg from matplotlib.figure import Figure import matplotlib.numerix as numerix import matplotlib.numerix.mlab as mlab from matplotlib.mlab import meshgrid How should I be using matplotlib/pylab in my utility scripts so that they are compatible with embedding in wx? Thanks, Ryan - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users