Anand Surampudi Anand Surampudi - 1 year ago 61
Python Question

IPython with and Without Notebook Differences

One of the most important improvisations of Python that are my favorites are IPython and IPython Notebook.

I was watching and repeating what's shown in this video and found some issues.

As specified in the video, I use

ipython --pylab
to launch IPython.
And I use
ipython notebook --pylab
to launch IPython Notebook.

would not work in IPython NoteBook (I get a
) but works fine in IPython.
Same is the case with the function
. I guess
is loaded along with
and other essential libraries.

Please tell me if I am wrong. By the way, both my IPython and IPython NoteBook load from my Anaconda Dist., if that means anything.

Also any resource where I can know what all is loaded when I use
would help.


Answer Source

This is what the pylab flag does:

import numpy
import matplotlib
from matplotlib import pylab, mlab, pyplot
np = numpy
plt = pyplot

from IPython.core.pylabtools import figsize, getfigs

from pylab import *
from numpy import *

That said, it is recommended that you launch the notebook without the flag (just ipython notebook) and then run:

%matplotlib inline

For more details see No Pylab Thanks.

Regarding your scatter problem, you should try the following:

%matplotlib inline
import matplotlib.pyplot as plt

plt.scatter([1,2], [1,2])
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download