Anand Surampudi - 1 year ago 40

Python Question

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`

And I use

`ipython notebook --pylab`

Issues:

`scatter()`

`NameError`

Same is the case with the function

`rand()`

`pylab`

`matplotlib`

`scipy`

`numpy`

`random`

Please tell me if I am wrong. By the way, both my IPython and IPython NoteBook load from my

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

`--pylab`

Thanks.

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])
```