Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python equivalent of Matlab's clear, close all, clc

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?

like image 859
TheRealFakeNews Avatar asked Aug 25 '15 23:08

TheRealFakeNews


1 Answers

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.

like image 111
Ben Avatar answered Sep 16 '22 19:09

Ben