|
From: Benjamin R. <ben...@ou...> - 2013-04-01 13:45:36
|
On Fri, Mar 29, 2013 at 7:30 PM, Michael Aye <mic...@uc...> wrote: > Is there a pylab version of ax.plot_surface? > I am asking because the following does not work when running an ipython > notebook in pylab mode: > #0: #create some data …. > #1: fig = plt.figure() > ax = fig.gca(projection='3d') > #2: surf = ax.plot_surface( …..) # taking the exact command from the > examples. > > I have verified that this code only does NOT work when #1 and #2 are > executed in different notebook cells. When they are combined in the > same cell, it works. > As I prefer the flexibility of being able to run everything anywhere, I > am asking for pylab versions of plot_surface, as I am mostly running > things in the pylab mode of the notebook. > > Cheers, > Michael > > The reason this does not work in separate cells is that a figure object gets closed at the end of a ipython cell. An ax object no longer works when its parent figure is closed. This is not limited to 3d plots. I would be surprised to see ax.plot() work if a non-3d axes object was made in a different cell. Ben Root |