Closing a figure from the notebook does not close the python figure

Aperta
#4 15 commenti 8 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript, jupyter-notebook, python
Ambito
backend, frontend

Direzione di ricerca

Inizia da js/src/mpl_widget.js, in particolare dalla funzione di rimozione dal DOM e dalla gestione del pulsante di chiusura del widget descritte nell’issue. Riproduci il problema eseguendo ripetutamente la cella del grafico e chiudendo esplicitamente il widget, quindi verifica che il numero di figure, l’uso della memoria e l’avviso relativo a più di 20 figure non aumentino più.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

This is essentially a regression of https://github.com/matplotlib/matplotlib/issues/4841 which happened when the nbagg backend was converted to a widget.

To reproduce create a cell with a simple plot.

plt.plot(range(10))
plt.show()

re execute the cell and observe that the figure count goes up and memory consumption goes up too. If you continue doing this you will eventually have more than 20 open figures and matplotlib will print a warning even if you only have one figure displayed.

The same is true if you explicitly close the widget using the widget close cross on the left of the figure.

I have spent some time trying to figure out how to best fix this but don't really know how to best do this. This function
is meant to trigger a close message to the python side when the figure is removed from the DOM but no longer works.

The old no longer existing close button is also intended to send a close signal to the python layer but this is not hooked up to the widget close button.

https://github.com/matplotlib/matplotlib/issues/6414 has some more related issues.

Lingua principale
Jupyter Notebook
Stelle
1.7k
Fork
234
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di matplotlib/ipympl

Tutte le issue di matplotlib/ipympl

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.