Matplotlib figures are not redrawn in the cell in which they are created
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
- jupyter-notebook, matplotlib, python
- Ambito
- data-visualization
Direzione di ricerca
Inizia eseguendo la riproduzione fornita nella stessa cella in JupyterLab o Notebook con il backend %matplotlib widget, quindi confrontala con la versione in celle separate. Il lavoro è completato quando fig.canvas.draw() aggiorna visibilmente la figura durante ogni iterazione del ciclo, invece che solo dopo l'uscita dal ciclo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Jupyter Notebook
- Stelle
- 1.7k
- Fork
- 234
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di matplotlib/ipympl
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
matplotlib/ipympl#623 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
matplotlib/ipympl#622 · 13 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
matplotlib/ipympl#612 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
matplotlib/ipympl#611 · 4 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
matplotlib/ipympl#609 · 7 commenti ·
Tutte le issue di matplotlib/ipympl
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
droidconKE/droidconKE2022Web#167 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
PedestrianDynamics/pyFDS-Evac#228 ·
I maintainer di solito rispondono entro 1 giorno
-
scope: charts status: waiting for maintainer
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 2 giorni
-
type/bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
I maintainer di solito rispondono entro 1 giorno
-
Dashboard "Export as PDF" doesn't split a long table when it's the last card on the dashboardAperta.Needs Triage .Team/UXWest Priority:P2 Type:Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
metabase/metabase#83085 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno