matplotlib on a mac

Hello everyone and always, thank you for your tremendous help. I was
just wondering, I need to get matplotlib to work on a mac but
unfortunately I've been running into some problems trying to get it to
work on a mac. I tried by installing the unstable version from source
using fink and that has some parts of matplotlib working fine, but I
can't seem to import pylab. Specifically, when matplotlib tries to
import pylab (from pylab import *), it eventually gets to
""from matplotlib._nc_backend_gdk import pixbuf_get_pixels_array"
ImportError: No module named _nc_backend_gdk.". It seems like i don't
have a _nc_backend_gdk.so file that I need.

Could someone please assist me in what I need to do or let me know of
a different way to get matplotlib and gtk/gtkagg to work on my mac?
I'm running Tiger on the mac.

Thank you very much,
Chris

Christopher Kang wrote:

Could someone please assist me in what I need to do or let me know of
a different way to get matplotlib and gtk/gtkagg to work on my mac? I'm running Tiger on the mac.

Do you really need GTK?

If not, you can use the installer at:

www.pythonmac.org/packages

It should work with TK, wx and Agg. I've heard someone is working on a Cocoa back-end which would be great, but it's not available now.

If you do need GTK, then you need to go the all-fink route: everything fink, including python itself, gtk, pygtk, etc.

Maybe whoever is maintaining the fink package can help out with your problems.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Hi,

I know this really belongs on the sourceforge.net:numarray list, but it is a very inactive list.

I have noted the following with numarray:

>>> x = numarray.zeros([3,3], numarray.Int16)
>>> i = [0,1,2,0,1,2]
>>> j = [0,1,2,0,1,2]
>>> x[i, j] += 1
>>> print x
[[1, 0, 0]
  [0, 1, 0]
[0, 0, 1]]
I was expecting (hoping)
[[2, 0, 0]
  [0, 2, 0]
  [0, 0, 2]]

which is what you obviously get if you:

for n in range(len(i)) : x[i[n], j[n]] += 1

This is the sort of operation one does all the time when histogramming data-streams. Is there a way to achieve this without looping over i/j.

cheers,

Graeme

Graeme O'Keefe wrote:

Hi,

I know this really belongs on the sourceforge.net:numarray list, but it is a very inactive list.

It's still the right place to ask. Your question would get answered in a timely manner. We're quiet; we're not gone. :slight_smile:

Followup-to has been reset.

I have noted the following with numarray:

>>> x = numarray.zeros([3,3], numarray.Int16)
>>> i = [0,1,2,0,1,2]
>>> j = [0,1,2,0,1,2]
>>> x[i, j] += 1
>>> print x
[[1, 0, 0]
[0, 1, 0]
[0, 0, 1]]
I was expecting (hoping)
[[2, 0, 0]
[0, 2, 0]
[0, 0, 2]]

which is what you obviously get if you:

for n in range(len(i)) : x[i[n], j[n]] += 1

This is the sort of operation one does all the time when histogramming data-streams. Is there a way to achieve this without looping over i/j.

This has been discussed recently on the numpy-discussion list (Subject: vectorizing histogram-like computation). The semantics of array indexing aren't anything like that for loop. I doubt that the two kinds of semantics could be merged consistently.

   x[i,j] += 1

is closer to

   x[i,j] = x[i,j] + 1

which amounts, in this case, to

   x[i,j] = array([1, 1, 1, 1, 1, 1])

There's nothing in this last operation to suggest that the numbers ought to be added together (and if the initial values weren't zero, a more complicated operation would have to considered).

In short, I consider it cleaner to keep specialized histogram code tucked away in a function which you can eventually optimize to C as required.

···

--
Robert Kern
rkern@...376...

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter