Message from discussion
trouble with pyplot in os x
Received: by 10.224.180.205 with SMTP id bv13mr3233532qab.8.1344113689045;
Sat, 04 Aug 2012 13:54:49 -0700 (PDT)
Received: by 10.66.85.37 with SMTP id e5mr505719paz.31.1344113601963;
Sat, 04 Aug 2012 13:53:21 -0700 (PDT)
Path: c6ni18905555qas.0!nntp.google.com!r1no15150680qas.0!news-out.google.com!g9ni9161852pbo.0!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From: Eric <einazaki...@yahoo.com>
Newsgroups: comp.lang.python
Subject: Re: trouble with pyplot in os x
Date: Sat, 4 Aug 2012 13:45:48 -0700 (PDT)
Organization: http://groups.google.com
Lines: 151
Message-ID: <f038f218-3a7b-4ff3-8cab-056a47990e93@googlegroups.com>
References: <3a2464ec-8fbc-4c45-8509-6861031f9204@googlegroups.com> <mailman.2936.1344089518.4697.python-list@python.org>
NNTP-Posting-Host: 70.230.151.65
Mime-Version: 1.0
X-Trace: posting.google.com 1344113601 20075 127.0.0.1 (4 Aug 2012 20:53:21 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 4 Aug 2012 20:53:21 +0000 (UTC)
Cc: Eric <einazaki...@yahoo.com>, python-l...@python.org,
"William R. Wing (Bill Wing)" <w...@mac.com>
In-Reply-To: <mailman.2936.1344089518.4697.python-list@python.org>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=70.230.151.65;
posting-account=5sjSAAkAAADWrvmYYN9Q5vfQ2WNdq-Wg
User-Agent: G2/1.0
Bytes: 4916
Content-Type: text/plain; charset=ISO-8859-1
On Saturday, August 4, 2012 8:11:44 AM UTC-5, William R. Wing (Bill Wing) wrote:
> On Aug 3, 2012, at 11:12 PM, Eric wrote:
>
>
>
> > I'm just starting to futz around with matplotlib and I tried to run this
>
> > example from the matplotlib doc page (it's the imshow() example):
>
> >
>
> > import numpy as np
>
> > import matplotlib.cm as cm
>
> > import matplotlib.mlab as mlab
>
> > import matplotlib.pyplot as plt
>
> >
>
> > delta = 0.025
>
> > x = y = np.arange(-3.0, 3.0, delta)
>
> > X, Y = np.meshgrid(x, y)
>
> > Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
>
> > Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
>
> > Z = Z2-Z1 # difference of Gaussians
>
> >
>
> > im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray,
>
> > origin='lower', extent=[-3,3,-3,3])
>
> >
>
> > plt.show()
>
> >
>
> >
>
>
>
> OK
>
>
>
> >
>
> > I get the following error:
>
> >
>
> > Exception in Tkinter callback
>
> > Traceback (most recent call last):
>
> > File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1410, in __call__
>
> > return self.func(*args)
>
> > File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 248, in resize
>
> > self.show()
>
> > File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 252, in draw
>
> > tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
>
> > File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 19, in blit
>
> > tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))
>
> > TclError
>
> >
>
> >
>
>
>
> This looks as though you are running the latest python from python.org, not the pre-installed python from Apple (that's good).
>
>
>
> >
>
> > I'm using Python 2.7.3 on OS X 10.6.8 and I'm invoking python by doing
>
> > "arch -i386 python" because matplotlib doesn't do 64-bit. Has anyone
>
> > else seen this? Does anyone know why this is happening? It looks
>
> > like a problem with tkinter but beyond that I haven't a clue. And,
>
> > finally, any ideas as to how to make it behave?
>
> >
>
>
>
> I DON'T know how tk is getting mixed into this, it shouldn't be. But I think I can tell you how to get matplotlib working...
>
>
>
> Matplotlib DOES do 64-bit, the problem is numpy, which as you download in binary form does not. But, if you copy the bash script here:
>
>
>
> https://raw.github.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh
>
>
>
> it will download the sources and build a 64-bit numpy, which will then give you a default 64-bit full package of python, numpy, and matplotlib.
>
>
>
> That's what I've done, and my system runs the demo you listed in your post with no problems.
>
>
>
> > TIA,
>
> > eric
>
> > --
>
> > http://mail.python.org/mailman/listinfo/python-list
>
>
>
> Good luck,
>
> -Bill
Yes, I got the Python 2.7 (and 3.2) distributions from python.org and I also got Tcl/Tk per their directions. I still have all the old Apple installed stuff too plus some older Tcl/Tk.
Doesn't matplotlib use Tk (Tkinter) to do its graphs and what-not? I also have at least two different versions of Tcl/Tk (8.5.7 and 8.5.12) and I'm wondering if that may not be causing problems.
I'll give that bash script a try.
Thanks,
eric