Closed
Description
Bug summary
The Macosx backend won't show a window until all the processing is completed, even when calling plt.show()
beforehand. For a continuously updating figure, this means that it will just hang forever without displaying anything. I can do this fine in Tkagg, but I'd like to be able to display retina-quality images.
Code for reproduction
import matplotlib, random
import matplotlib.pyplot as plt
matplotlib.use('macosx') #Works fine with tkagg
data = []
#Initial Draw
fig, axes = plt.subplots(1)
line, = axes.plot(data, label='Some data', color='#CC0000')
fig.canvas.draw_idle()
plt.show(block=False)
while True:
data += [random.randint(0,50) for i in range(20)]
tseries = range(0, len(data))
line.set_ydata(data)
line.set_xdata(tseries)
axes.relim()
axes.autoscale_view(tight=False)
if fig.stale: fig.canvas.draw()
fig.canvas.flush_events() #Listen for user input
Actual outcome
Python hangs forever, waiting for the while
loop to complete.
Expected outcome
As with Tkagg, it should launch the window first and continuously update the plot.
Additional information
No response
Operating system
Mac OS 10.15
Matplotlib Version
3.5.2
Matplotlib Backend
MACOSX
Python version
3.10.5
Jupyter version
No response
Installation
pip