plt.pause uses removed `start_event_loop_default` API
See original GitHub issueAs the title suggests, attempting to pause through matplotlib currently raises an error. The minimum working example is:
%matplotlib widget
from matplotlib import pyplot as plt
plt.plot([1,2,3])
plt.pause(1)
plt.plot([3,2,1])
plt.close()
This raises an attribute error trying to call FigureCanvasBase.start_event_loop_default. A little googling suggests this function has been removed since version 3.0.
Taking inspiration from #17, I guess the simplest get around is using time.sleep but is there a better solution?
Thanks for your help.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:10 (2 by maintainers)
Top Results From Across the Web
matplotlib.pyplot.pause — Matplotlib 3.6.2 documentation
If there is an active figure, it will be updated and displayed before the pause, and the GUI event loop (if any) will...
Read more >python - Is there a way to detach matplotlib plots so that the ...
I may use something like a time-out-question "End of script! \nPress p if you want the plotting output to be paused (you have...
Read more >matplotlib.pyplot.pause() in Python - GeeksforGeeks
The pause() function in pyplot module of matplotlib library is used to pause for interval seconds. Syntax: matplotlib.pyplot.pause(interval).
Read more >How To Clear A Plot In Python (without closing the window)
Click to clear a plot using two methods - clearing Pyplot Figure or ... Matplotlib's pyplot API is stateful, which means that it...
Read more >Speeding up Matplotlib - Bastibe.de
import matplotlib.pyplot as plt import numpy as np import time fig, ... I am using pause() here to update the plot without blocking....
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

I’m not sure sleep works for me because in my case I want to pause for matplotlib event handling.
In my case I have code running in a loop that needs to periodically update the plot and get mouse events from the plot.
Is this a problem in jupyter-matplotlib or in matplotlib in general?
@Michael-Equi I think my proposed solution should work pretty well as a permanent fix. The issue is that it has remained as “proposed” and never made it all the way to implemented