Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Plot disappears after executing cell second time

Aperta
#60 13 commenti 9 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
jupyter-notebook, matplotlib, python

Direzione di ricerca

Inizia riproducendo i due esempi di celle del notebook in JupyterLab e Jupyter Notebook con i backend widget e inline segnalati. Confronta le esecuzioni ripetute della cella di plotting e conferma che il plot basato su widget rimanga visibile e venga nuovamente renderizzato come previsto senza rieseguire la cella di selezione del backend.

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

Descrizione

If I have a plot in a notebook cell, and execute it twice, the plot output disappears. This is not what is expected. For example, using this code in one jupyter notebook cell:

%matplotlib widget
import matplotlib.pyplot as plt

and this in another cell:

x = [0, 1, 2, 3]
y = [0, 1, 2, 3]

plt.plot(x, y)

The first time I run this, everything plots fine. But when I execute the second cell twice (or any following calls), the plot disappears. The expected behaviour is that it re-plots (using a different colour). If I then re-run the first cell (with %matplotlib widget), and then the second cell again, it works (but this basically just resets the plot).

If I include a plot command in the first cell, then I can re-run the second cell as many times as I want and it works as expected.

This does not happen if I use %matplotlib inline. I've tested in both jupyter lab and jupyter notebook. My versions are the following:

matplotlib                2.2.2                    py36_1    conda-forge
ipympl                    0.2.1                    py36_0    conda-forge
@jupyter-widgets/jupyterlab-manager
        @jupyter-widgets/jupyterlab-manager v0.35.0  enabled  OK
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 Data Visualization

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.