I have a Python script myscript.py which looks like this:
$ cat myscript.py
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [1, 3, 2])
When running IPython in pylab mode:
$ ipython --pylab
Executing the following command (line 2 in my script) will result in the graphics popping up in a new window:
In []: plt.plot([1, 2, 3], [1, 3, 2])
On the other hand, when running myscript.py, the image will not be shown:
In []: %run myscript.py
Is there any way to change this behaviour and force IPython to show the images generated within the script?