Re: [Matplotlib-users] plot a triangular mesh

2009-05-26 Thread Robert Kern
On 2009-05-23 21:35, Eric Carlson wrote: > Hello Robert, > I studied delaunay and mlab.griddata a bit while converting tinterp and > saw the > > """ > tri = delaunay.Triangulation(x,y) > # interpolate data > interp = tri.nn_interpolator(z) > zo = interp(xi,yi

Re: [Matplotlib-users] plot a triangular mesh

2009-05-25 Thread Ondrej Certik
On Mon, May 25, 2009 at 1:03 AM, Robert Cimrman wrote: > Ondrej Certik wrote: >> >> On Fri, May 22, 2009 at 3:37 PM, Ondrej Certik wrote: >>> >>> Thanks a lot John. I tried that and it does what I want. I just need >>> to convert and probably average my 3 different values at the 3 >>> vertices of

Re: [Matplotlib-users] plot a triangular mesh

2009-05-25 Thread Robert Cimrman
Ondrej Certik wrote: > On Fri, May 22, 2009 at 3:37 PM, Ondrej Certik wrote: >> Thanks a lot John. I tried that and it does what I want. I just need >> to convert and probably average my 3 different values at the 3 >> vertices of the triangle and color the triangle with that color. When >> I get i

Re: [Matplotlib-users] plot a triangular mesh

2009-05-23 Thread Eric Carlson
Hello Robert, I studied delaunay and mlab.griddata a bit while converting tinterp and saw the """ tri = delaunay.Triangulation(x,y) # interpolate data interp = tri.nn_interpolator(z) zo = interp(xi,yi) """ stuff. In studying delaunay, however, it was/is not cle

Re: [Matplotlib-users] plot a triangular mesh

2009-05-23 Thread Robert Kern
On 2009-05-23 17:17, Eric Carlson wrote: > I should read entire posts before sending people down the wrong > pathways. I just happened to be working on a Python equivalent to MATLAB > "triplot" stuff when I read your subject line and made the wrong > assumptions. That program does just plot the edg

Re: [Matplotlib-users] plot a triangular mesh

2009-05-23 Thread Eric Carlson
I should read entire posts before sending people down the wrong pathways. I just happened to be working on a Python equivalent to MATLAB "triplot" stuff when I read your subject line and made the wrong assumptions. That program does just plot the edges, as you noted. I have attached a python p

Re: [Matplotlib-users] plot a triangular mesh

2009-05-22 Thread Ondrej Certik
> Ok, I made a progress, it seems it's working. Script and picture Forgot to attach the script. Ondrej from hermes2d import Mesh, H1Shapeset, PrecalcShapeset, H1Space, \ WeakForm, Solution, ScalarView, LinSystem, DummySolver, Linearizer from hermes2d.forms import set_forms from hermes2d.ex

Re: [Matplotlib-users] plot a triangular mesh

2009-05-22 Thread Ondrej Certik
On Fri, May 22, 2009 at 7:06 AM, John Hunter wrote: > On Thu, May 21, 2009 at 9:31 PM, Ondrej Certik wrote: >> Hi, >> >> I have a set of vertices in 2D as triples (x, y, val), where the x, y >> are 2D coordinates and "val" is the scalar value of the finite element >> solution, here is an example:

Re: [Matplotlib-users] plot a triangular mesh

2009-05-22 Thread Eric Carlson
Here is an example using matplotlib.delaunay, which automatically returns the edges and triangules: import matplotlib.delaunay as delaunay import matplotlib.pyplot as pp #generate points npts=41 xpt=sp.random.random_sample(npts) ypt=sp.random.random_sample(npts) #create triangulation circumcen

Re: [Matplotlib-users] plot a triangular mesh

2009-05-22 Thread John Hunter
On Thu, May 21, 2009 at 9:31 PM, Ondrej Certik wrote: > Hi, > > I have a set of vertices in 2D as triples (x, y, val), where the x, y > are 2D coordinates and "val" is the scalar value of the finite element > solution, here is an example: > > In [54]: l.get_vertices() > Out[54]: > array([[ 0.