[IPython-User] pylab backend question

Fernando Perez fperez.net@gmail....
Mon Jun 18 17:07:29 CDT 2012


On Mon, Jun 18, 2012 at 10:20 AM, Toby Burnett <tburnett@uw.edu> wrote:
> Thanks, I could do that if I'm starting an interactive session. However, this use case is:
>
> ipython notebook --profile=notebook --pylab --no-browser --ip=$HOSTNAME
>
> I suppose I could leave off that --pylab and have to have every notebook include those lines, but --pylab=agg would be cleaner.

I've moved towards always initializing matplotlib explicitly in the
notebook myself, because that way:

1. the notebook is fully self-contained and doesn't depend on how the
server was started
2. the server doesn't start *every* kernel with --pylab, letting me
choose when I need matplotlib and when I don't.

Since in your case all you need is a tiny bit of logic to do 'import
matplotlib; matplotlib.use("agg")', I suggest you either do it
explicitly at the start of your notebook, or put it into your startup
profile.  It's too much of a small corner case to warrant messing with
our already quite convoluted pylab integration machinery.

Cheers,

f


More information about the IPython-User mailing list