Need to create and update figures in seperate cells?
See original GitHub issueSomething 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)
Issue Analytics
- State:
- Created 2 years ago
- Comments:7
Top Results From Across the Web
How to Automatically Update Data in Another Sheet in Excel
Go to the destination worksheet and click the cell where you want to link the cell from the source worksheet.
Read more >Update fields - Microsoft Support
Update all fields in a document · Press Ctrl + A. · Press F9. · If your document has tables with fields or...
Read more >How to Update Table and Figure Numbers in Microsoft Word
Select Update entire table to update the table or figure numbers in your list of tables or figures.
Read more >How to Update Table and Figure Numbers in Microsoft Word
These steps will also update your list of tables or list of figures. ... How to Create and Update a List of Tables...
Read more >Word 2010-2007 Auto Update formulas in a table - YouTube
You cannot auto update formulas in word, but here is one step to reduce the concern in sending out quotations or invoices.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
as an aside I would recommend instead of clearing and redrawing every time you should use the set_data methods. e.g
ahh and it turns out that there is a pretty simple workaround for the meantime