Is there a way to close a plot created with matplotlib from a command in terminal (without having to close the window with mouse)?
I'm using zsh on macos 10.15.7
Let's say I have a file plot1.py with following content:
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4])
plt.ylabel('some numbers')
plt.show()
from the command line, when I execute python plot1.py this opens a window displaying the plot. What I would like to do is close this window from the terminal with a keyboard command. I tried ctrl + c and ctrl + y without success and I have to close the window with the mouse by clicking on the close button
Note: I am not using anaconda (as mentioned in this question