[Numpy-discussion] Convert data into rectangular grid
Mon Sep 28 18:48:46 CDT 2009
On Mon, Sep 28, 2009 at 7:19 PM, jah <firstname.lastname@example.org> wrote:
> Suppose I have a set of x,y,c data (something useful for
> matplotlib.pyplot.plot() ). Generally, this data is not rectangular at
> all. Does there exist a numpy function (or set of functions) which will
> take this data and construct the smallest two-dimensional arrays X,Y,C (
> suitable for matplotlib.pyplot.contour() ).
> Essentially, I want to pass in the data and a grid step size in the x- and
> y-directions. The function would average the c-values for all points which
> land in any particular square. Optionally, I'd like to be able to specify a
> value to use when there are no points in x,y which are in the square.
> Hope this makes sense.
If I understand correctly numpy.histogram2d(x, y, ..., weights=c) might do
what you want.
There was a recent thread on its usage.
> NumPy-Discussion mailing list
More information about the NumPy-Discussion