On Mon, Sep 20, 2010 at 5:01 PM, John Salvatier <jsalvati@u.washington.edu> wrote:
Hello,

Is there a way to do "asynchronous" plots in matplotlib? By asynchronous I mean plots that simply spawn a new process and do not stop the program while the plot is visible? For example, I would like to be able to run a script that plots something and have the program end with the plot still useable so I can run the script again and generate a slightly different plot that I can compare side by side with the first.

John


John,

matplotlib does have an interactive mode that can be turned on with a call to plt.ion().  Note that any figure is spawned as a child thread.  If you run a script from the command line, the script won't end until the figure is closed (hence you can't start another script).

However, another possible route is to design your code as functions that take a figure or axes object, you could then just call the needed functions for an existing axes object.

Another possibility (and maybe this is what you meant originally) is to have a python or ipython  session open and import the desired scripts in order to execute them (with interactive mode turned on).

I hope this is helpful!
Ben Root