Issue
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.
Issues: scatter()
would not work in IPython NoteBook (I get a NameError
) but works fine in IPython.
Same is the case with the function rand()
. I guess pylab
is loaded along with matplotlib
, scipy
, numpy
, random
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 --pylab
would help.
Thanks.
Solution
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])
Answered By - elyase
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.