From: Hajas, W. <Way...@df...> - 2009-01-13 20:17:49
|
I'm just getting into matplotlib and python. My apologies if I just haven't found the obvious documentation. I am running XP/Enthought Python 2.5/Idle/matplotlib 0.98.5.2 I run one of the scripts from the tutorial: import numpy as np import matplotlib.pyplot as plt mu, sigma = 100, 15 x = mu + sigma * np.random.randn(10000) # the histogram of the data n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75) plt.xlabel('Smarts') plt.ylabel('Probability') plt.title('Histogram of IQ') plt.text(60, .025, r'$\mu=100,\ \sigma=15$') plt.axis([40, 160, 0, 0.03]) plt.grid(True) plt.show() A window with the figure appears on my screen. It looks very nice. But now my PYTHON-Shell screen is dead. I can go to the figure window. I right click on the upper-border to close the window. I get the following error message on the PYTHON-Shell. Exception in Tkinter callback Traceback (most recent call last): File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__ return self.func(*args) File "C:\Python25\lib\idlelib\MultiCall.py", line 151, in handler r = l[i](event) File "C:\Python25\lib\idlelib\ScriptBinding.py", line 166, in run_module_event interp.runcode(code) File "C:\Python25\lib\idlelib\PyShell.py", line 701, in runcode self.interp.restart_subprocess() AttributeError: ModifiedInterpreter instance has no attribute 'interp' And the shell-window is still dead. I can't do anything else until I close all my Python windows. Is there a better way to close the figure-window? Should I expect IDLE to work with matplotlib? Should I try and figure out Ipython instead? Should I look for a Tkinter installation? My current version is Revision: 50704? Any help or suggestions are appreciated. Wayne Hajas Pacific Biological Station 3190 Hammond Bay Road Nanaimo, BC Canada V9T 6N7 way...@df... <mailto:ha...@df...> (250)756-7367 |
From: Massimo S. <mas...@un...> - 2009-01-13 22:48:33
|
I have the vague remembrance of the fact that IDLE does not play well with matplotlib. Can you try to run the program from the command line and see if it gives the same error? m. -- Massimo Sandal , Ph.D. University of Bologna Department of Biochemistry "G.Moruzzi" snail mail: Via Irnerio 48, 40126 Bologna, Italy email: mas...@un... web: http://www.biocfarm.unibo.it/samori/people/sandal.html tel: +39-051-2094388 fax: +39-051-2094387 -----Messaggio originale----- Da: Hajas, Wayne [mailto:Way...@df...] Inviato: mar 13/01/2009 21.05 A: mat...@li... Oggetto: [Matplotlib-users] Newbie question/closing a figure-window I'm just getting into matplotlib and python. My apologies if I just haven't found the obvious documentation. I am running XP/Enthought Python 2.5/Idle/matplotlib 0.98.5.2 I run one of the scripts from the tutorial: import numpy as np import matplotlib.pyplot as plt mu, sigma = 100, 15 x = mu + sigma * np.random.randn(10000) # the histogram of the data n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75) plt.xlabel('Smarts') plt.ylabel('Probability') plt.title('Histogram of IQ') plt.text(60, .025, r'$\mu=100,\ \sigma=15$') plt.axis([40, 160, 0, 0.03]) plt.grid(True) plt.show() A window with the figure appears on my screen. It looks very nice. But now my PYTHON-Shell screen is dead. I can go to the figure window. I right click on the upper-border to close the window. I get the following error message on the PYTHON-Shell. Exception in Tkinter callback Traceback (most recent call last): File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__ return self.func(*args) File "C:\Python25\lib\idlelib\MultiCall.py", line 151, in handler r = l[i](event) File "C:\Python25\lib\idlelib\ScriptBinding.py", line 166, in run_module_event interp.runcode(code) File "C:\Python25\lib\idlelib\PyShell.py", line 701, in runcode self.interp.restart_subprocess() AttributeError: ModifiedInterpreter instance has no attribute 'interp' And the shell-window is still dead. I can't do anything else until I close all my Python windows. Is there a better way to close the figure-window? Should I expect IDLE to work with matplotlib? Should I try and figure out Ipython instead? Should I look for a Tkinter installation? My current version is Revision: 50704? Any help or suggestions are appreciated. Wayne Hajas Pacific Biological Station 3190 Hammond Bay Road Nanaimo, BC Canada V9T 6N7 way...@df... <mailto:ha...@df...> (250)756-7367 |
From: Mauro C. <mau...@gm...> - 2009-01-13 23:20:51
|
Dear Wayne, 2009/1/13 Hajas, Wayne <Way...@df...>: > > Should I expect IDLE to work with matplotlib? Should I try and figure out > Ipython instead? > Definetely, IPython *is* the environment to work with Python plus Matplotlib, as it already includes built-in support for interactive use of MPL (and in general too, as IPython offers a lot more resources than IDLE). Hope this helps! Best regards, -- Dr. Mauro J. Cavalcanti Ecoinformatics Studio P.O. Box 46521, CEP 20551-970 Rio de Janeiro, RJ, BRASIL E-mail: mau...@gm... Web: http://studio.infobio.net Linux Registered User #473524 * Ubuntu User #22717 "Life is complex. It consists of real and imaginary parts." |
From: Richard J. <soy...@tb...> - 2009-01-14 00:33:41
|
I have had similar experiences with IDLE on both XP and Ubuntu 8.04 and as a result I use IPython as much as possible. On XP I would recommend that you install Python(x,y), 2.1.9, http://www.pythonxy.com/foreword.php which includes IPython(0.9.1) and IDLE(1.2.2) as well as many other useful programs. The example you gave runs under IPython with the command run -i programname.py and gives a plot which can be accessed independently of the IPython shell. In other words you can execute commands in the shell while the plot is still on the screen. Hope this helps Richard p.s. I, like you, would still be interested in knowing why IDLE crashes when a .py script is run twice. Richard Johns rj...@tb... On Tue, 2009-01-13 at 12:05 -0800, Hajas, Wayne wrote: > I'm just getting into matplotlib and python. My apologies if I just > haven't found the obvious documentation. > > I am running XP/Enthought Python 2.5/Idle/matplotlib 0.98.5.2 > > I run one of the scripts from the tutorial: > > import numpy as np > import matplotlib.pyplot as plt > > mu, sigma = 100, 15 > x = mu + sigma * np.random.randn(10000) > > # the histogram of the data > n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', > alpha=0.75) > > plt.xlabel('Smarts') > plt.ylabel('Probability') > plt.title('Histogram of IQ') > plt.text(60, .025, r'$\mu=100,\ \sigma=15$') > plt.axis([40, 160, 0, 0.03]) > plt.grid(True) > > plt.show() > > > A window with the figure appears on my screen. It looks very nice. > But now my PYTHON-Shell screen is dead. > > I can go to the figure window. I right click on the upper-border to > close the window. I get the following error message on the > PYTHON-Shell. > > > Exception in Tkinter callback > Traceback (most recent call last): > File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in > __call__ > return self.func(*args) > File "C:\Python25\lib\idlelib\MultiCall.py", line 151, in > handler > r = l[i](event) > File "C:\Python25\lib\idlelib\ScriptBinding.py", line 166, > in run_module_event > interp.runcode(code) > File "C:\Python25\lib\idlelib\PyShell.py", line 701, in > runcode > self.interp.restart_subprocess() > AttributeError: ModifiedInterpreter instance has no attribute > 'interp' > > > > And the shell-window is still dead. I can't do anything else until I > close all my Python windows. > > Is there a better way to close the figure-window? > > Should I expect IDLE to work with matplotlib? Should I try and figure > out Ipython instead? > > Should I look for a Tkinter installation? My current version is > Revision: 50704? > > Any help or suggestions are appreciated. > > > Wayne Hajas > Pacific Biological Station > 3190 Hammond Bay Road > Nanaimo, BC > Canada > V9T 6N7 > way...@df... > (250)756-7367 |
From: Mauro C. <mau...@gm...> - 2009-01-14 00:42:44
|
Gentlemen, I would recommend, in turn, Enthought Python (http://www.enthought.com), which also includes IPyhton, Matplotlib and many other useful libraries (eg. PIL) not included in Python(x,y). Hope this helps. Best regards, 2009/1/13 Richard Johns <soy...@tb...>: > I have had similar experiences with IDLE on both XP and Ubuntu 8.04 and > as a result I use IPython as much as possible. On XP I would recommend > that you install Python(x,y), 2.1.9, > http://www.pythonxy.com/foreword.php > which includes IPython(0.9.1) and IDLE(1.2.2) as well as many other > useful programs. > > The example you gave runs under IPython with the command > > run -i programname.py > > and gives a plot which can be accessed independently of the IPython > shell. In other words you can execute commands in the shell while the > plot is still on the screen. > > Hope this helps > > Richard > > p.s. I, like you, would still be interested in knowing why IDLE crashes > when a .py script is run twice. > > Richard Johns > rj...@tb... > > > > On Tue, 2009-01-13 at 12:05 -0800, Hajas, Wayne wrote: >> I'm just getting into matplotlib and python. My apologies if I just >> haven't found the obvious documentation. >> >> I am running XP/Enthought Python 2.5/Idle/matplotlib 0.98.5.2 >> >> I run one of the scripts from the tutorial: >> >> import numpy as np >> import matplotlib.pyplot as plt >> >> mu, sigma = 100, 15 >> x = mu + sigma * np.random.randn(10000) >> >> # the histogram of the data >> n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', >> alpha=0.75) >> >> plt.xlabel('Smarts') >> plt.ylabel('Probability') >> plt.title('Histogram of IQ') >> plt.text(60, .025, r'$\mu=100,\ \sigma=15$') >> plt.axis([40, 160, 0, 0.03]) >> plt.grid(True) >> >> plt.show() >> >> >> A window with the figure appears on my screen. It looks very nice. >> But now my PYTHON-Shell screen is dead. >> >> I can go to the figure window. I right click on the upper-border to >> close the window. I get the following error message on the >> PYTHON-Shell. >> >> >> Exception in Tkinter callback >> Traceback (most recent call last): >> File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in >> __call__ >> return self.func(*args) >> File "C:\Python25\lib\idlelib\MultiCall.py", line 151, in >> handler >> r = l[i](event) >> File "C:\Python25\lib\idlelib\ScriptBinding.py", line 166, >> in run_module_event >> interp.runcode(code) >> File "C:\Python25\lib\idlelib\PyShell.py", line 701, in >> runcode >> self.interp.restart_subprocess() >> AttributeError: ModifiedInterpreter instance has no attribute >> 'interp' >> >> >> >> And the shell-window is still dead. I can't do anything else until I >> close all my Python windows. >> >> Is there a better way to close the figure-window? >> >> Should I expect IDLE to work with matplotlib? Should I try and figure >> out Ipython instead? >> >> Should I look for a Tkinter installation? My current version is >> Revision: 50704? >> >> Any help or suggestions are appreciated. >> >> >> Wayne Hajas >> Pacific Biological Station >> 3190 Hammond Bay Road >> Nanaimo, BC >> Canada >> V9T 6N7 >> way...@df... >> (250)756-7367 > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Dr. Mauro J. Cavalcanti Ecoinformatics Studio P.O. Box 46521, CEP 20551-970 Rio de Janeiro, RJ, BRASIL E-mail: mau...@gm... Web: http://studio.infobio.net Linux Registered User #473524 * Ubuntu User #22717 "Life is complex. It consists of real and imaginary parts." |
From: Hajas, W. <Way...@df...> - 2009-01-14 16:24:22
|
Thanks to everybody who responded to my original post. I think Massimo put it best: IDLE does not play well with matplotlib. I will just have to learn how to be effective with ipython. Cheers, Wayne Hajas Pacific Biological Station 3190 Hammond Bay Road Nanaimo, BC Canada V9T 6N7 way...@df... (250)756-7367 -----Original Message----- From: Mauro Cavalcanti [mailto:mau...@gm...] Sent: Tuesday, January 13, 2009 4:43 PM To: Richard Johns Cc: Hajas, Wayne; mat...@li... Subject: Re: [Matplotlib-users] Newbie question/closing a figure-window Gentlemen, I would recommend, in turn, Enthought Python (http://www.enthought.com), which also includes IPyhton, Matplotlib and many other useful libraries (eg. PIL) not included in Python(x,y). Hope this helps. Best regards, 2009/1/13 Richard Johns <soy...@tb...>: > I have had similar experiences with IDLE on both XP and Ubuntu 8.04 > and as a result I use IPython as much as possible. On XP I would > recommend that you install Python(x,y), 2.1.9, > http://www.pythonxy.com/foreword.php > which includes IPython(0.9.1) and IDLE(1.2.2) as well as many other > useful programs. > > The example you gave runs under IPython with the command > > run -i programname.py > > and gives a plot which can be accessed independently of the IPython > shell. In other words you can execute commands in the shell while the > plot is still on the screen. > > Hope this helps > > Richard > > p.s. I, like you, would still be interested in knowing why IDLE > crashes when a .py script is run twice. > > Richard Johns > rj...@tb... > > > > On Tue, 2009-01-13 at 12:05 -0800, Hajas, Wayne wrote: >> I'm just getting into matplotlib and python. My apologies if I just >> haven't found the obvious documentation. >> >> I am running XP/Enthought Python 2.5/Idle/matplotlib 0.98.5.2 >> >> I run one of the scripts from the tutorial: >> >> import numpy as np >> import matplotlib.pyplot as plt >> >> mu, sigma = 100, 15 >> x = mu + sigma * np.random.randn(10000) >> >> # the histogram of the data >> n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', >> alpha=0.75) >> >> plt.xlabel('Smarts') >> plt.ylabel('Probability') >> plt.title('Histogram of IQ') >> plt.text(60, .025, r'$\mu=100,\ \sigma=15$') >> plt.axis([40, 160, 0, 0.03]) >> plt.grid(True) >> >> plt.show() >> >> >> A window with the figure appears on my screen. It looks very nice. >> But now my PYTHON-Shell screen is dead. >> >> I can go to the figure window. I right click on the upper-border to >> close the window. I get the following error message on the >> PYTHON-Shell. >> >> >> Exception in Tkinter callback >> Traceback (most recent call last): >> File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in >> __call__ >> return self.func(*args) >> File "C:\Python25\lib\idlelib\MultiCall.py", line 151, in >> handler >> r = l[i](event) >> File "C:\Python25\lib\idlelib\ScriptBinding.py", line 166, >> in run_module_event >> interp.runcode(code) >> File "C:\Python25\lib\idlelib\PyShell.py", line 701, in >> runcode >> self.interp.restart_subprocess() >> AttributeError: ModifiedInterpreter instance has no attribute >> 'interp' >> >> >> >> And the shell-window is still dead. I can't do anything else until I >> close all my Python windows. >> >> Is there a better way to close the figure-window? >> >> Should I expect IDLE to work with matplotlib? Should I try and >> figure out Ipython instead? >> >> Should I look for a Tkinter installation? My current version is >> Revision: 50704? >> >> Any help or suggestions are appreciated. >> >> >> Wayne Hajas >> Pacific Biological Station >> 3190 Hammond Bay Road >> Nanaimo, BC >> Canada >> V9T 6N7 >> way...@df... >> (250)756-7367 > > > ---------------------------------------------------------------------- > -------- > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Dr. Mauro J. Cavalcanti Ecoinformatics Studio P.O. Box 46521, CEP 20551-970 Rio de Janeiro, RJ, BRASIL E-mail: mau...@gm... Web: http://studio.infobio.net Linux Registered User #473524 * Ubuntu User #22717 "Life is complex. It consists of real and imaginary parts." |
From: John H. <jd...@gm...> - 2009-01-14 17:41:26
|
On Wed, Jan 14, 2009 at 10:24 AM, Hajas, Wayne <Way...@df...> wrote: > Thanks to everybody who responded to my original post. > > I think Massimo put it best: IDLE does not play well with matplotlib. I > will just have to learn how to be effective with ipython. This may be true that idle doesn't play well with mpl, but I don't know why it should be (it used to work ok). It is definitely in your interest to learn ipython (it's easy) but if you want to try idle, make sure you read http://matplotlib.sourceforge.net/users/shell.html Also, when this came up in the past, people suggested to run idle with -n and set the os.environ['PYTHONINSPECT'] = '1' evnironment variable, eg http://mail.python.org/pipermail/edu-sig/2005-January/004362.html |
From: Mauro C. <mau...@gm...> - 2009-01-14 00:43:40
|
Gentlemen, I would recommend, in turn, Enthought Python (http://www.enthought.com), which also includes IPyhton, Matplotlib and many other useful libraries (eg. PIL) not included in Python(x,y). Hope this helps. Best regards, 2009/1/13 Richard Johns <soy...@tb...>: > I have had similar experiences with IDLE on both XP and Ubuntu 8.04 and > as a result I use IPython as much as possible. On XP I would recommend > that you install Python(x,y), 2.1.9, > http://www.pythonxy.com/foreword.php > which includes IPython(0.9.1) and IDLE(1.2.2) as well as many other > useful programs. > > The example you gave runs under IPython with the command > > run -i programname.py > > and gives a plot which can be accessed independently of the IPython > shell. In other words you can execute commands in the shell while the > plot is still on the screen. > > Hope this helps > > Richard > > p.s. I, like you, would still be interested in knowing why IDLE crashes > when a .py script is run twice. > > Richard Johns > rj...@tb... > > > > On Tue, 2009-01-13 at 12:05 -0800, Hajas, Wayne wrote: >> I'm just getting into matplotlib and python. My apologies if I just >> haven't found the obvious documentation. >> >> I am running XP/Enthought Python 2.5/Idle/matplotlib 0.98.5.2 >> >> I run one of the scripts from the tutorial: >> >> import numpy as np >> import matplotlib.pyplot as plt >> >> mu, sigma = 100, 15 >> x = mu + sigma * np.random.randn(10000) >> >> # the histogram of the data >> n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', >> alpha=0.75) >> >> plt.xlabel('Smarts') >> plt.ylabel('Probability') >> plt.title('Histogram of IQ') >> plt.text(60, .025, r'$\mu=100,\ \sigma=15$') >> plt.axis([40, 160, 0, 0.03]) >> plt.grid(True) >> >> plt.show() >> >> >> A window with the figure appears on my screen. It looks very nice. >> But now my PYTHON-Shell screen is dead. >> >> I can go to the figure window. I right click on the upper-border to >> close the window. I get the following error message on the >> PYTHON-Shell. >> >> >> Exception in Tkinter callback >> Traceback (most recent call last): >> File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in >> __call__ >> return self.func(*args) >> File "C:\Python25\lib\idlelib\MultiCall.py", line 151, in >> handler >> r = l[i](event) >> File "C:\Python25\lib\idlelib\ScriptBinding.py", line 166, >> in run_module_event >> interp.runcode(code) >> File "C:\Python25\lib\idlelib\PyShell.py", line 701, in >> runcode >> self.interp.restart_subprocess() >> AttributeError: ModifiedInterpreter instance has no attribute >> 'interp' >> >> >> >> And the shell-window is still dead. I can't do anything else until I >> close all my Python windows. >> >> Is there a better way to close the figure-window? >> >> Should I expect IDLE to work with matplotlib? Should I try and figure >> out Ipython instead? >> >> Should I look for a Tkinter installation? My current version is >> Revision: 50704? >> >> Any help or suggestions are appreciated. >> >> >> Wayne Hajas >> Pacific Biological Station >> 3190 Hammond Bay Road >> Nanaimo, BC >> Canada >> V9T 6N7 >> way...@df... >> (250)756-7367 > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Dr. Mauro J. Cavalcanti Ecoinformatics Studio P.O. Box 46521, CEP 20551-970 Rio de Janeiro, RJ, BRASIL E-mail: mau...@gm... Web: http://studio.infobio.net Linux Registered User #473524 * Ubuntu User #22717 "Life is complex. It consists of real and imaginary parts." |
From: Richard J. <soy...@tb...> - 2009-01-14 02:32:44
|
On Tue, 2009-01-13 at 22:43 -0200, Mauro Cavalcanti wrote: > Gentlemen, > > I would recommend, in turn, Enthought Python > (http://www.enthought.com), which also includes IPyhton, Matplotlib > and many other useful libraries (eg. PIL) not included in Python(x,y). > > Hope this helps. > > Best regards, > Just to clarify your comments re: Python(x,y) as I wasn't sure myself I checked on http://www.pythonxy.com/download.php . The full edition of Python(x,y) 2.1.9 contains all of the software you mentioned(PIL, matplotlib, IPython, Enthought Tool Suite) while any of these missing from the basic and light editions can be added as plugins. Another thing I like about Python(x,y) is that it is updated frequently so that you are always working with the most up-to-date software without having to compile it yourself. rj Richard Johns rj...@tb... |
From: Mauro C. <mau...@gm...> - 2009-01-14 11:26:15
|
Dear Richard, 2009/1/14 Richard Johns <soy...@tb...>: > The full edition of Python(x,y) 2.1.9 contains all of the software you > mentioned(PIL, matplotlib, IPython, Enthought Tool Suite) while any of > these missing from the basic and light editions can be added as plugins. Enthought Python includes a lot more pre-packaged Python libraries than Python(x,y) -- for example, the wxPython GUI library (unfortunately, in my surely biased opinion, the developers of Python(x,y) did not include wxPython in their distribution), and MPL Basemap toolkit. > Another thing I like about Python(x,y) is that it is updated frequently > so that you are always working with the most up-to-date software without > having to compile it yourself. Well, none of these pre-packaged distribution is really "up-to-date", as the development versions of the libraries (those available only via svn) will of course never be included. Best regards, -- Dr. Mauro J. Cavalcanti Ecoinformatics Studio P.O. Box 46521, CEP 20551-970 Rio de Janeiro, RJ, BRASIL E-mail: mau...@gm... Web: http://studio.infobio.net Linux Registered User #473524 * Ubuntu User #22717 "Life is complex. It consists of real and imaginary parts." |