Wednesday, April 30, 2014

A note on iPython

Notebook

A Note on iPython notebook

Since this blog is going to feature a lot of code, I'm going to use a suitable
platform to display code and output in html. My solution is iPython notebook,
which I learned about at PyCon 2014.

If you're not familiar with iPython notebook, I highly recommend it. It allows
you to run ipython terminals in your browser, embed their outputs, and export
everything to html. Here's an example.

In [1]:
print "hello world"
hello world

In [2]:
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np

x = np.arange(0, 2*np.pi, np.pi/64.)
y = np.sin(x)

plt.plot(x, y)
Out[2]:
[<matplotlib.lines.Line2D at 0x113dad210>]

Anyways, I'll be using ipython notebook going forward, just in case you see
something cool and want to know how I did it.

No comments:

Post a Comment