Re: [Matplotlib-users] A request for code critique
João, Thank you for commenting on the code. sys.argv check is a wise one. Since I was the only user of this little snippet I didn't give attention of this detail, however eventually some other people will start using the code too. I thought it is more efficient to only import functions that I use from modules. This said, I don't see much speed difference on two codes. Is import statement (or Python itself) intelligent enough to import only the modules that are used inside a program or does it load all content at the original import time? Mouse-hover readings are really nice to have while analysing the data, and ability of setting its sensitivity comes handier sometimes. I wish I could find a way to put such a mechanism on my recent poster presentation. Hah, maybe I should use a flexible lcd and let viewers to interract with the poster themselves instead of viewing things on a dry big sheet of paper. Yes, the IPython call from shell still stays a mystery... Gökhan On Thu, May 14, 2009 at 12:52 PM, João Luís Silva jsi...@fc.up.pt wrote: Gökhan SEVER wrote: Hello, After solving the boxplotting mystery, and figuring out how to change the mouse hover reading sensitivities, I have finished my small script which creates boxplots from a given file. I can call it either by issueing ./splot.py file or from inside ipython -pylab with run command. However I still couldn't figure out how to drop in ipython from the bash shell call while all my variable context visible in the ipython namespace. I am attaching the script and a sample file I used. Could you please comment whether I am on the right track? I am not very sure my locals() use is correct to create a variable name from a given file name. There might be other points that seem weaker in the code as well. Thank you. Gökhan The code looks pretty good to me. I've done some minor style changes on the imports, and added an error check to see if the user passed a parameter or not. I didn't know how to change the mouseover format, this will be useful for me, thanks! I'm only a casual user of ipython, and I don't know how to do what you ask, so I'll leave that to someone else. (new splot.py attached) Best regards, João Silva -- Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] A request for code critique
On Sun, May 17, 2009 at 2:17 PM, Gökhan SEVER gokhanse...@gmail.com wrote: Hello Roy, ipython splot.py 09_03_23_11_44_54.stats.tas works, but I can't make it work with pylab switch. It executes my script, however whos list an empty namespace :( Gökhan, The whos command works for me. Also, why can't you use import pylab and make your plots directly in ipython? You can also use from pylab import * if you don't want to type pylab every time. In [1]: whos Variable TypeData/Info argv list['splot.py', '09_03_23_11_44_54.stats.tas'] argv_arr ndarray 12x13: 156 elems, type `float64`, 1248 bytes axes functionfunction axes at 0x92b6064 axis functionfunction axis at 0x92b6294 boxplotfunctionfunction boxplot at 0x92b6924 d09_03_23_11_44_54_stats_tas ndarray 12x13: 156 elems, type `float64`, 1248 bytes data_len int 12 draw functionfunction draw at 0x9212dbc f fileclosed file '09_03_23_11...', mode 'r' at 0x88ef260 i int 11 loadtxtfunctionfunction loadtxt at 0x8b65304 mouse_hover_formatxfunctionfunction mouse_hover_formatx at 0x88e84fc mouse_hover_formatyfunctionfunction mouse_hover_formaty at 0x88e84c4 plot functionfunction plot at 0x92b6cdc savefigfunctionfunction savefig at 0x9212df4 show functionfunction show at 0x920f72c skiprows int 30 -- Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] A request for code critique
Hmm, Is it working on your side from a bash shell as ipython --pylab script argument I couldn't make it work in this fashion. As I said whos list nothing :( I am on Fedora 10 x86, Python 2.5.2, IPython 0.10.bzr.r1173 Without the pylab switch I see the interactive space with variables. I also have plot imported from my script, however each time I have to call show() to see the figure to be re-drawn. To me, it seems one need to compromise: either to start ipython --pylab first and call scripts using run magic command or like you suggested start ipython with the script loaded and call show() after each plot command. Please comment me if I am wrong... Gökhan On Sun, May 17, 2009 at 3:19 PM, Roy Hyunjin Han starsareblueandfara...@gmail.com wrote: On Sun, May 17, 2009 at 2:17 PM, Gökhan SEVER gokhanse...@gmail.com wrote: Hello Roy, ipython splot.py 09_03_23_11_44_54.stats.tas works, but I can't make it work with pylab switch. It executes my script, however whos list an empty namespace :( Gökhan, The whos command works for me. Also, why can't you use import pylab and make your plots directly in ipython? You can also use from pylab import * if you don't want to type pylab every time. In [1]: whos Variable TypeData/Info argv list['splot.py', '09_03_23_11_44_54.stats.tas'] argv_arr ndarray 12x13: 156 elems, type `float64`, 1248 bytes axes functionfunction axes at 0x92b6064 axis functionfunction axis at 0x92b6294 boxplotfunctionfunction boxplot at 0x92b6924 d09_03_23_11_44_54_stats_tas ndarray 12x13: 156 elems, type `float64`, 1248 bytes data_len int 12 draw functionfunction draw at 0x9212dbc f fileclosed file '09_03_23_11...', mode 'r' at 0x88ef260 i int 11 loadtxtfunctionfunction loadtxt at 0x8b65304 mouse_hover_formatxfunctionfunction mouse_hover_formatx at 0x88e84fc mouse_hover_formatyfunctionfunction mouse_hover_formaty at 0x88e84c4 plot functionfunction plot at 0x92b6cdc savefigfunctionfunction savefig at 0x9212df4 show functionfunction show at 0x920f72c skiprows int 30 -- Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users