[IPython-User] matplotlib integration without pylab

Nikolaus Rath Nikolaus@rath....
Sun Mar 11 15:46:35 CDT 2012


David Warde-Farley <wardefar@iro.umontreal.ca> writes:
> On 2012-03-11, at 1:43 PM, Nikolaus Rath wrote:
>
>> Hello,
>> 
>> Is there a way to get --pylab style matplotlib integration (i.e., no
>> need for blocking calls to matplotlib.pyplot.show() to display figures)
>> without any of the other effects that come with --pylab? In particular,
>> I do not want my namespace to be polluted with all the pylab commands.
>
> Use --gui=<backend>.

Have you tried that? It doesn't work here.

# ipython --gui=gtk
Python 2.7.2+ (default, Nov 30 2011, 19:22:03) 
Type "copyright", "credits" or "license" for more information.

IPython 0.12 -- An enhanced Interactive Python.

In [1]: from matplotlib import pyplot as plt

In [2]: import numpy as np

In [3]: plt.plot(np.arange(10), np.arange(10)**2)
Out[3]: [<matplotlib.lines.Line2D at 0x2b28f90>]

[no windows shown ]

In [4]: plt.show()

[window visible, call blocks]


Best,

   -Nikolaus

-- 
 »Time flies like an arrow, fruit flies like a Banana.«

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C


More information about the IPython-User mailing list