I am using iPython to do some coding. When I open the notebook and run some codes by doing SHIFT+ENTER it runs. But after one or two times, it stops giving any output. Why i
You should not use plt.show()
in the notebook. This will open an external window that blocks the evaluation of your cell.
Instead begin your notebooks with %matplotlib inline
or the cool new %matplotlib notebook
(the latter is only possible with matplotlib
>= 1.4.3 and ipython
>= 3.0)
After the evaluation of each cell, the (still open) figure object is automatically shown in your notebook.
This minimal code example works in notebook. Note that it does not call plt.show()
%matplotlib inline
import matplotlib.pyplot as plt
x = [1,2,3]
y = [3,2,1]
_ = plt.plot(x,y)
%matplotlib inline
simply displays the image.
%matplotlib notebook
was added recently and offers many of the cool features (zooming, measuring,...) of the interactive backends: