29 авг. 2013 г.

How to turn on embedded graphics in IPython Notebook

I've recently discovered another great Python data analysis tool - IPython notebook. It is a web-based interactive computational environment where you can combine code execution, text, mathematics, plots and rich media into a single document:



I find it very useful and it makes me comfortable to make interactive computing using Python. Not only text, but all the graphics generated by a user can be embedded into an IPython document.This feature is turned off by default and thus we need to execute IPython Notebook application using the following key:

ipython notebook --pylab=inline

This command will start the notebook application. After it is loaded, you can try to check the embedded graphics feature by executing the sample code:

from pylab import *
x = linspace(0, 5, 10)
y = x ** 2
figure()
plot(x, y, 'r')
xlabel('x')
ylabel('y')
title('title')
show()

And you should see something like this:

Комментариев нет:

Отправить комментарий