matplotlib / matplotlib/ipympl
Need to create and update figures in seperate cells?
Nessuno ha ancora preso questa issue.
- Lingua principale
- Jupyter Notebook
- Stelle
- 1.7k
- Fork
- 234
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Something I've seen in previous versions as well as the current version: In order to have a figure that dynamically updates while some code is executing (e.g. tracking the loss function of an optimization), I have to create the figure in a separate jupyter notebook cell and run it before a I run the code that updates. If I don't do this, then a blank figure shows and never updates. I'm using Jupyter lab. Wondering if I'm doing something wrong here? It would make the code cleaner and easier to run if it could all be put in a single cell.
Example:
Using the following function:
def update_function(fig, ax):
while True:
# Do some computation
ax.clear() #clear previously drawn
ax.plot(some_data)
fig.canvas.draw() #force it to update
This works:
# cell 1
fig, ax = plt.subplots()
# cell 2
update_function(fig, ax)
But this does not:
# one combined cell
fig, ax = plt.subplots()
update_function(fig, ax)
Guida per i contributori
Apri la guida per i contributori
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.
Direzione di ricerca
L’issue non indica alcun file o test del repository. Inizia riproducendo in JupyterLab gli esempi con celle separate e celle combinate, quindi confronta l’effetto di update_function, che ha una lunga durata, sul rendering. Il lavoro è completato quando la cella combinata aggiorna la figura come richiesto, oppure quando l’issue documenta una limitazione confermata e il relativo workaround corretto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- jupyter, jupyter-notebook, python
- Ambito
- data-visualization, frontend
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 35/100