import matplotlib matplotlib.use("TkAgg") import matplotlib.pyplot as plt fig, ax = plt.subplots(layout="constrained") ax.plot([1, 2, 3, 4], [2, 5, 3, 6], marker="o") ax.set_title("Interactive backend smoke test") ax.set_xlabel("Run") ax.set_ylabel("Value") plt.show(block=False) plt.pause(3) manager = plt.get_current_fig_manager() print(f"backend: {matplotlib.get_backend()}") print(f"manager: {type(manager).__name__}") print(f"figures: {plt.get_fignums()}") plt.close("all") print(f"closed: {plt.get_fignums()}")