Note: Cross-posting on IPy devel and Matplotlib-users list.

Hello,

My 8 hours sleep have helped me solve the riddle of IPython pylab entry from
a regular Python script. Although it is funky and experimental, it works
just as I have been seeking it to work for months :)

Here take a look at this piece of code:

(Again, the following lines must be modified in /IPython/Shell.py to start
with pylab each time a request is made for IPython instantiation. To me a
line can be added into ipy_user_config such as always_pylab =True )

     #user_opts = set([s.replace('-','') for s in argv[:3]])     user_opts =
set(['pylab'])


#!/usr/bin/env python

#import matplotlib.pyplot as plt
#import numpy as np
import IPython

ipy = IPython.Shell.start(user_ns=locals())

a = arange(10)           ###<-- I am in IPython -pylab at this point no need
for np.arange
plot(a)                        ###<-- or plt.plot(a)

ipy.mainloop()

Later, when I drop into the IPy shell I can go ahead and manipulate my
figure appropriately. Now whos() works also :)


Gökhan
------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to