[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: plot (x,y,z) triplets as a surface?




Andrew <noymer@my-deja.com> writes:

> 
>    Is there any way to read (x,y,z) triplets into IDL and make a
> surface?  Sorry if this is a terrible newbie question.

Hmm... Does this work?

; Open and read data
openr, 50, 'file.dat'
triples = fltarr(3,ntriples)
readf, 50, triples
close, 50

; Plot data.  NX * NY = NTRIPLES
surf = reform(triples(2,*), nx, ny)
surface, surf

The key point is the reform expression, which takes the third
component of the triplet (triple(2,*)) and then reforms it into a 2D
array.

If you have irregular sampling or non-rectangular coverage then
obviously things start getting more difficult...

Craig


-- 
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------