# [Matrix-SIG] placing points in a grid...

**David Ascher
**
David Ascher <da@skivs.ski.org>

*Mon, 6 Apr 1998 15:42:37 -0700 (PDT)*

I have a function evaluated at a set of points ((p1x, p1y), (p2x, p2y),
...)). The pNx's are in an array px, the pNy's are in an array py.
I wish to 'place' these in a zero-filled grid I for display. The grid is
a PxQ grid where the X axis corresponds to an array of x values xs, and
the Y axis to an array of y value ys.
I can do this by:
datapoints = func(px, py[:,NewAxis])
for i in range(len(px)):
x = px[i]
y = py[i]
xi = searchsorted(x, xs)
yi = searchsorted(y, ys)
I[xy,yi] = datapoints