[Numpy-discussion] Convert data into rectangular grid
josef.pktd at gmail.com
josef.pktd at gmail.com
Mon Sep 28 19:48:46 EDT 2009
On Mon, Sep 28, 2009 at 7:19 PM, jah <jah.mailinglist at gmail.com> wrote:
> Hi,
>
> 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.
Josef
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
More information about the NumPy-Discussion
mailing list