Try something like this:
import pylab as pl
head = ((0, 0, 10),
(1, 0, 13),
(2, 0, 11),
(3, 0, 12),
(1, 2, 11))
x, y, z = zip(*head)
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
> x y head
> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users