trouble with pyplot in os x

Eric einazaki668 at yahoo.com
Fri Aug 3 23:12:45 EDT 2012


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()



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



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?

TIA,
eric



More information about the Python-list mailing list