New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nbagg: "Close figure" action does not 'close' the figure object #4281
Comments
It should behave like the GUI backends. It sounds like one of the call backs is not quite right. attn @pelson |
Hmmm. I remember our UAT document explicitly covers these kinds of scenarios. |
I think this particular case is not included in the UAT notebook. You have UAT 5 - No show without plt.show in non-interactive mode, but I was working in interactive mode (I used |
In my experience:
[IPKernelApp] ERROR | No such comm: 3d1517c3278342538a577515ab22e5a1 |
Is there any workaround for this problem? This is preventing me to use the |
The workaround is |
Have a similar issue - originally posted in ipython, copying essential here. The behaviour on calling %matplotlib notebook
f = plt.figure()
plt.plot([1,2,3], [1,2,3]) -> figure appears plt.close(f)
plt.gcf() -> figure image appears (non interactive) However if you group the commands in a single cell: %matplotlib notebook
f = plt.figure()
plt.plot([1,2,3], [1,2,3])
plt.close(f)
plt.gcf() No image appears (and the layout is also somewhat broken - using Firefox). Calling |
Also, some people have mentioned that using the oo interface is preferred, but if you are using pandas or seaborn for plotting they work in a procedural way and you don't have control over that, so it still needs to work in procedural mode. |
I believe that all of the pandas plotting function take On Tue, Jun 2, 2015 at 6:27 AM mangecoeur notifications@github.com wrote:
|
I am not fully sure how the notebook backend is supposed to work (and I also did not found any documentation on it?), but the following did surprise me a bit:
The above creates an interactive figure in the notebook.
But when I close it (the red button with cross) and the figure is displayed in the notebook as a static image, a subsequent plotting call does nothing:
It is only when I explicitely create a new figure that it is displayed:
or if I explicitly close the previous figures with e.g.
plt.close('all')
.So to me it seems like the
plt.plot
call is still seeing the original figure as the current figure and so trying to plot it on this original figure, but as this is already displayed as a static image in the previous cell, this does not do anything.I don't know if this is on purpose, but e.g. with the qt or gtk backend when you close a figure,
plt.plot
will create a new figure automatically, and not trying to plot on the current figure anymore (as this is closed).matplotlib 1.4.3, ipython 3.0, windows 7
The text was updated successfully, but these errors were encountered: