plotting from within ipython, and then go on in the shell calculations

Whenever I use matplotlib, I will perform something like the following in an ipython shell (no special flags):

import matplotlib.pyplot as plt

fig = plt.figure()

<do things, like adding axes to the figure and plotting>

fig.show() # this will cause the window to pop up, and give me back a prompt for ipython

<do more things, like modifying the axes and updating using plt.draw()>

fig.savefig(…) # if you want to save a copy

As far as I have seen, this is not one of the recommended methods in the documentation, and considering my cursory understanding of the internals, I’m not sure if this is technically correct or a hack, but it works perfectly well for me. I discovered this function in Figure objects when I was trying to get around exactly the same problem.

Uri

···

---------- Forwarded message ----------
From: qubax@…1843…
To: Jeff Whitaker <jswhit@…83…146…>

Date: Wed, 14 Oct 2009 02:09:21 +0200
Subject: Re: [Matplotlib-users] plotting from within ipython, and then go on in the shell calculations
but i want to:

  1. plot something
  2. go on in ipython (with the figure/plot staying on)

is that really not possible?

thanks,
q