In Matlab, at the beginning of every file, I usually write
clear; close all; clc
Is there something similar to this in Python? What do most people do when testing their scripts?
The catch here is that plt.show() is blocking and will not return to the script until the window is closed manually. You can try plt.draw(), which is interactive and will allow the script to continue running after the figure has been drawn.
Matplotlib Show Documentation
There is another question which discusses the difference between show and draw:
Difference between plt.show() and plt.draw()
Then the close should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With