I am trying to get an interactive matplotlib plot to run. From the tutorial I tried this code:
import matplotlib.pyplot as plt
plt.ion()
plt.plot([1.6, 2.7])
If I copy it into a shell everything works fine and a window opens.
But if I try to execute the code in a script with python3 script.py after a second it returns back to the shell without showing any window.
It seems that this seems be a popular problem, but no solution I found on the internet was working.
I tried adding plt.show() and plt.draw(), as well a loop so that the program does not immediately exit. But then there is just the python rocket bouncing in my doc indefinitely.
I tried different backends, but the symptoms where the same for all of them.
I installed python3 using homebrew and matplotlib using pip3. I run macOS 10.14.6.