fossekall fossekall - 10 months ago 81
Python Question

Jupyter shows plot without

I am using the Jupyter notebook with Python 2.7. Importing matplotlib like this:

%matplotlib inline
import matplotlib.pyplot as plt

But I have observed one thing. When I use Python in Spyder I always have to use the ` commando at the end of the python script in order to see the plots.

In Jupyter I do not need this command in order to see a plot. I do get this error message:

[<matplotlib.lines.Line2D at 0x91615d0>]

but it still makes a plot. Why is that?


You turn on the immediate display with %matplotlib inline.

The line:

[<matplotlib.lines.Line2D at 0x91615d0>]

is no error message. It is the return value of the last command. Try adding a ; at the end of the last line to suppress this.