question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

figure changes size at end of loop if drawn dynamically

See original GitHub issue

As 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:

gyrodown

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:open
  • Created 6 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
KICcommented, Jan 4, 2021

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

3reactions
malbergocommented, Dec 3, 2020

Any updates on this front?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found