Hi,
This indeed does the job. But after playing a little bit with the code, I have discovered a few things:
first, I'd rather work with lists not tuples so I could actually change my huge array of points.
second the array I described is kind of a pseudo 2D:
It has one big row.
[1,    0,    13],
[2,    0,    11],
[3,    0,    12],
[1,    2,    11]]

When I try to use a 3D array, with rows and columns

import pylab as pl

head = [[[0,    0,    10],  [0,    1,    13]],
[[1,    0,    11],   [1,    1,    12]],
[[2,    1,    11],   [2,    2,    14]]]

xi, yi = pl.arange(0, 4, 0.1), pl.arange(0, 3, 0.1)
g = pl.griddata(x, y, z, xi, yi)
pl.scatter(x, y)
pl.contour(xi, yi, g)
pl.show()

I get this error:
Traceback (most recent call last):
File "asfplot.py", line 9, in <module>
ValueError: need more than 2 values to unpack

On Sat, Sep 20, 2008 at 2:19 PM, Goyo wrote:
Try something like this:

import pylab as pl

(1,    0,    13),
(2,    0,    11),
(3,    0,    12),
(1,    2,    11))

xi, yi = pl.arange(0, 4, 0.1), pl.arange(0, 3, 0.1)
g = pl.griddata(x, y, z, xi, yi)
pl.scatter(x, y)
pl.contour(xi, yi, g)

Level values are automatically chosen in this example but you can
provide the number of values or a sequence of them.

Note that no extrapolation is done outside convex hull defined by input
data.

Goyo

El sáb, 20-09-2008 a las 11:13 +0200, Oz Nahum escribió:
> I'm trying again to understand how to plot scattered data from array into
>    contour graph.
>    I looked at
>    http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data
>    and I understand I have to grid my data. However, in most samples the plot
>    is of a function.
>    Let's say I want to plot some geological data, suppose water table head, and
>    I have the following 3D aray
>    head =  ((0,    0,    10),
>                (1,    0,    13),
>                (2,    0,    11),
>                (3,    0,    12),
>                (1,    2,    11))
>    matplotlib has lot's of restrictions about how I can plot and interpolate
>    the data, which causes a lot of confusion in my side...
>    I'll be happy if someone could supply me a clue of how to plot contours of
>    data which comes in arrays or raster format and not an equation.
>    Thanks,
>    Oz
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
.''`.
: :' : We are debian.org. Lower your prices,
distinctiveness to our own.
Resistance is futile.

----
Imagine there's no countries
It isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
----
You all must read 'The God Delusion'
http://en.wikipedia.org/wiki/The_God_Delusion
---
when one person suffers from a delusion it is called insanity. When many people suffer from a delusion it is called religion."
Robert Pirsig, Zen and the Art of Motorcycle Maintenance