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 -- http://mail.python.org/mailman/listinfo/python-list