Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Plot disappears after executing cell second time

Offen
#60 13 Kommentare 9 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
jupyter-notebook, matplotlib, python

Rechercherichtung

Beginnen Sie damit, die beiden Beispiele aus den Notebook-Zellen in JupyterLab und Jupyter Notebook mit den gemeldeten Widget- und Inline-Backends zu reproduzieren. Vergleichen Sie die wiederholte Ausführung der Plot-Zelle und bestätigen Sie, dass der Widget-basierte Plot sichtbar bleibt und wie erwartet erneut gerendert wird, ohne die Zelle zur Backend-Auswahl erneut auszuführen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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
Vorherrschende Sprache
Jupyter Notebook
Sterne
1.7k
Forks
236
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus matplotlib/ipympl

Alle Issues in matplotlib/ipympl

Ähnliche Issues

Weitere Issues zu Data Visualization

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.