[IPython-dev] --pylab flag deprecated

Abraham D. Flaxman abie at uw.edu
Wed Mar 5 12:53:04 EST 2014


This reminds me, is there an easy way to make the first cell in my notebook include these lines by default?

And that reminds me, is there an easy way to make the name of a notebook more descriptive than UntitledXXX by default?

Thanks for all your work on this amazing project!

--Abie


From: ipython-dev-bounces at scipy.org [mailto:ipython-dev-bounces at scipy.org] On Behalf Of Fernando Perez
Sent: Wednesday, March 5, 2014 7:08 AM
To: IPython developers list
Subject: Re: [IPython-dev] --pylab flag deprecated

Hi Vasco,

the recommended approach, that will make in the long run your notebooks more readable, is to use

%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

atop your notebooks. That will make it easier to know what comes from where.  Now, if you *really* want to have a lot of top-level plotting and numerical functions, and are willing to pay the price that for example doing a lot of automatic imports clobbers the built-in python sum() function with numpy.sum() (which can cause some surprises), you can still do

%pylab inline

at the top.  We will probably never remove this, partly because it's still useful for *quick and dirty* analysis where you just want to do something fast with minimal overhead, and is mostly throw-away scratch work.  This kind of typing economy is also still very useful at the console.

But in the long run, our experience is that notebooks tend to linger for a long time: in that scenario, it's worth paying the price of slightly more verbose code with explicit imports, in order to reap the benefits of readability in the long run.

Cheers,

f

On Wed, Mar 5, 2014 at 4:05 AM, Vasco Tenner <vasco+python at tenner.nl<mailto:vasco+python at tenner.nl>> wrote:
Hi,
I used to start ipython notebook with the --pylab flag, so I have all
kinds of usefull functions directly available. By guessing and
tab-completion many usefull functions, for data analysis popped up.
(like plot, display etc).

Now the --pylab flag will deprecate soon, what is the best alternative
for an interactive environment. I already found it usefull to import
from pylab:

from pylab import *

However, the --pylab flag did more: it also loaded a bunch of ipython
functions, like IPython.display.display.

Is there a preffered way to load this? To configure this in some
enviroment?

I just found the
%pylab
magic. Should I put this in the top cell of all my notebooks? What
should I advice to my starting collegues?

Groet,
Vasco
_______________________________________________
IPython-dev mailing list
IPython-dev at scipy.org<mailto:IPython-dev at scipy.org>
http://mail.scipy.org/mailman/listinfo/ipython-dev



--
Fernando Perez (@fperez_org; http://fperez.org)
fperez.net-at-gmail: mailing lists only (I ignore this when swamped!)
fernando.perez-at-berkeley: contact me here for any direct mail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140305/754cf47f/attachment.html>


More information about the IPython-dev mailing list