Getting Started with Ipython Notebook

Install Ipython by running the following command in your terminal

$ pip install ipython

After the installation is done, run Ipython Instance by running the following command

$ ipython notebook

This will open Ipython Notebook Server instance in your default web browser.

To create a new notebook click on the New Notebook button. This will open a Notebook instance and you can start making beautifully presented and documented notebooks.

Example Notebook:


In [2]:
print "Hello World"


Hello World
Basic plotting:

Before plotting using matplotlib use the following magic function to set things up.


In [13]:
%matplotlib inline

In [14]:
#Matplotlib example Code

from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.gca(projection='3d')

x = np.linspace(0, 1, 100)
y = np.sin(x * 2 * np.pi) / 2 + 0.5
ax.plot(x, y, zs=0, zdir='z', label='zs=0, zdir=z')

colors = ('r', 'g', 'b', 'k')
for c in colors:
    x = np.random.sample(20)
    y = np.random.sample(20)
    ax.scatter(x, y, 0, zdir='y', c=c)

ax.legend()
ax.set_xlim3d(0, 1)
ax.set_ylim3d(0, 1)
ax.set_zlim3d(0, 1)


Out[14]:
(0, 1)

In [ ]: