On 8/21/07, Geoffrey Zhu <[EMAIL PROTECTED]> wrote: > Hi Everyone, > > I just started to use pylab, and there are two issues I can't figure > out a way to get around. > > 1. show() does not return until I close the plot window. This makes it > impossible to show multiple plots at the same time. How can I show > multiple plots?
The way pylab displays things requires you to have an active GUI main loop running in order for the plots to show up and be active. One way around it is to use the ipython -pylab mode. This starts the GUI in a thread and does some magic behind the scenes so that you can keep typing at the prompt while a figure is showing. If you're trying to show multiple plots from a program and you don't want to block, I wrote a pylab plot server called ez_plot that you may find of use. You can get it from pypi or via "easy_install ez_plot". Basically when you call ez_plot.Plotter().<pylab command> it packs the method name and all its arguments up and sends it to the plot server to plot. If the server isn't running it starts one up. The plot server is just a separate process that sits around waiting for people to send it plotting commands. But since it's a separate process it can sit in the GUI loop without affecting the control flow of your code. I use it mostly for debugging. You can do something like this in the header of your python file to switch back and forth: if debug: import ez_plot Plot = ez_plot.Plotter() else: from matplotlib import pylab as Plot > 2. How can I get a handle or object reference to the plot window so > that I can manipulate it specifically? > > I found some references to the API. The API seems quite different from > the plot interface and is considerably low-level. So am just wondering > if using the API is the only way to do these things. It seems to me > that if plot(...) can return an object reference to the chart winodw, > all these can easily be solved. Most commands do return an object that you can manipulate. Again ipython is a big help here. Just try x = pylab.plot(somethign), and then you can use ipython's tab completion and such to quickly see what sort of things you can do with the x you got back. --bb ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users