figure changes size at end of loop if drawn dynamically
See original GitHub issueAs per the title, consider the following snippet:
import time
import ipympl
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1, figsize=(5, 5))
data = []
plt.show()
for idx in range(4):
data.append(idx ** 2)
ax.clear()
ax.plot(data)
fig.canvas.draw()
time.sleep(0.2)
and this is what I get running it:

I used plt.show() at the beginning of the loop because nothing gets drawn otherwise.
Is there a way to avoid this?
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
figure changes size at end of loop if drawn dynamically #17
I used plt.show() at the beginning of the loop because nothing gets drawn otherwise. Is there a way to avoid this?
Read more >How to update a plot on same figure during the loop?
Using matplotlib.pyplot.draw(), It is used to update a figure that has been changed. It will redraw the current figure.
Read more >Dynamically updating plot in matplotlib - python - Stack Overflow
I want the plot to be updated when data is received. I searched on how to do this and found two methods: Clear...
Read more >Interactive figures — Matplotlib 3.6.2 documentation
Interactive mode controls: whether created figures are automatically shown. whether changes to artists automatically trigger re-drawing existing figures. when ...
Read more >Root locus plot of dynamic system - MATLAB rlocus - MathWorks
You can use rlocus to plot the root locus diagram of any of the following negative feedback loops by setting sys as shown...
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

This bug is now 3 years old and I still have this issue. Are there any plans how this can be fixed?
Any updates on this front?