Matplotlib figures are not redrawn in the cell in which they are created
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- jupyter-notebook, matplotlib, python
- Bereich
- data-visualization
Rechercherichtung
Beginne damit, die bereitgestellte Reproduktion in derselben Zelle in JupyterLab oder Notebook mit dem %matplotlib widget-Backend auszuführen, und vergleiche sie dann mit der Version in separaten Zellen. Als erledigt gilt es, wenn fig.canvas.draw() die Abbildung während jeder Schleifeniteration sichtbar aktualisiert, statt erst nach Ende der Schleife.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the issue
Using an interactive figure's canvas.draw() method does not update the figure if it was created in the same cell as the draw call.
Figure created in the same cell:

Figure created in another cell:

Reproduce
- Open a new notebook in JupyterLab or Notebook
- Insert the following code:
import matplotlib.pyplot as plt
import time
%matplotlib widget
fig = plt.figure()
for i in range(5):
x = list(range(i+2))
xx = [x**2 for x in x]
plt.clf()
plt.plot(x, xx)
fig.canvas.draw()
time.sleep(1)
- Run the cell and observe that the plot does not show until the loop has exited.
Optional:
- Move the for loop to a separate cell from the figure creation
- Run cell and observe plot updates during the loop
This can be reproduced using the scipy notebook docker stack.
Versions
3.8.5 | packaged by conda-forge | (default, Jul 31 2020, 02:39:48)
[GCC 7.5.0]
ipympl version: 0.5.7
jupyter core : 4.6.3
jupyter-notebook : 6.0.3
qtconsole : not installed
ipython : 7.17.0
ipykernel : 5.3.4
jupyter client : 6.1.6
jupyter lab : 2.1.5
nbconvert : 5.6.1
ipywidgets : 7.5.1
nbformat : 5.0.7
traitlets : 4.3.3
Known nbextensions:
config dir: /opt/conda/etc/jupyter/nbconfig
notebook section
jupyter-matplotlib/extension enabled
- Validating: OK
jupyter-js-widgets/extension enabled
- Validating: OK
JupyterLab v2.1.5
Known labextensions:
app dir: /opt/conda/share/jupyter/lab
@bokeh/jupyter_bokeh v2.0.3 enabled OK
@jupyter-widgets/jupyterlab-manager v2.0.0 enabled OK
jupyter-matplotlib v0.7.3 enabled OK
- Vorherrschende Sprache
- Jupyter Notebook
- Sterne
- 1.7k
- Forks
- 234
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus matplotlib/ipympl
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
matplotlib/ipympl#623 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
matplotlib/ipympl#622 · 13 Kommentare ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 42/100
matplotlib/ipympl#612 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
matplotlib/ipympl#611 · 4 Kommentare ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 42/100
matplotlib/ipympl#609 · 7 Kommentare ·
Alle Issues in matplotlib/ipympl
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
developmentseed/lonboard#1287 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
PedestrianDynamics/pyFDS-Evac#338 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area/panel/table area/transformations automated-triage issue/auto-triaged team/grafana-datapro type/bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
grafana/grafana#133808 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
business-science/timetk#175 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag