Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

nbagg: Closing a figure from the notebook does not close the python figure #18447

Copy link
Copy link
Closed
@sbitzer

Description

@sbitzer
Issue body actions

I'm reporting a digression from previous behaviour of the nbagg backend in Jupyter notebooks. Until matplotlib 3.2.2, when I refreshed an interactive figure in a notebook cell by re-executing the cell, the existing figure would be closed and a new one created using the old figure number (when the cell also created the original figure). In matplotlib 3.3.1 the old figure is replaced by the new figure (with a new figure number) in the notebook output, but the old figure still exists in the kernel.

I guess this is related to "NbAgg and WebAgg no longer use jQuery & jQuery UI" from the release notes of matplotlib 3.3.0. Also, ipympl has the same issue: matplotlib/ipympl#4.

This can be tested in a notebook with:

%matplotlib notebook
import matplotlib.pyplot as plt
fig = plt.figure()
plt.get_fignums()

I saw this behaviour in recent versions of Firefox and Google Chrome.

I have manually applied 2c9a85b in case this would reintroduce the old behaviour (which I prefer), but it didn't.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.