MathGroup Archive 1994

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: ListContourPlot for irregular sampling

  • To: mathgroup at christensen.Cybernetics.NET
  • Subject: [mg251] Re: [mg218] ListContourPlot for irregular sampling
  • From: "Roberto Abraham at the Institute of Astronomy, Cambridge" <abraham at mail.ast.cam.ac.uk>
  • Date: Tue, 29 Nov 1994 18:43:16 +0000 (GMT)

Hi Stefan,

I've encountered situations similar to yours on a number of occasions
(it's a common problem in astronomy), and I've found a number of
solutions. The one that seems to work best for me is to write a small
function has as its arguments the x,y position you want to sample and the
list of data.  The function simply takes the list of data and returns a
value at the x,y position that's the weighted average of the nearest n
data points, where each point is weighted according to the square of its
distance from to the point at which you're evaluating the function. I've
found that using the nearest 3-5 neighbors seems to work well, depending
on how sparse your data is, but you should experiment with different
values. The final function can be plotted up using ContourPlot or Plot3D
or whatever. If you need to evaluate the function really quickly then
it's easy to resample the grid evenly and define function values using
the Interpolation function.

If you can wait a couple of days I can send you a package with some code
(I've just moved to Cambridge and all my Mathematica stuff is still on my
Mac at home, rather than on my machine at work). However, it's very easy
to code up the algorithm. 

Cheers,


Bob

--------------------------------------------------------------------
Dr. R. G. Abraham                      abraham at mail.ast.cam.ak.uk
Institute of Astronomy
Cambridge University
Madingley Rd., Cambridge 
CB3 OHA
United Kingdom
-------------------------------------------------------------------

On Wed, 23 Nov 1994, Dr. Stefan P. Mueller wrote:

> I need to generate contour plots of data which are not sampled on an evenly
> spaced Cartesian grid. ListContourPlot ony accepts data in the form of an
> nxm matrix of heights z which are evenly sampled, i.e.
> 
>         data = {z11,z12,z13, ...,z1n},
>                {z21,z22,z23, ...,z2n},
>                ...
>                {zm1,zm2,zm3, ...,zmn}};
> 
> whereas my data have the following structure
> 
>         data = {{x1,y1,z1},{x2,y2,z2}, ..., {xm,ym,zm}};
> 
> i.e. each height is also assciated with its own x and y coordinate.
> Does anybody know about a package to plot data with this structure?
> 
> Thank you in advance!
> 
> Stefan
> ____________________________________________________________________________
> Dr. Stefan P. Mueller, Nuklearmedizin, Universitaetsklinikum, D-45122 Essen,
> FR Germany, e-mail: onm010 at aixrs1.hrz.uni-essen.de, FAX: <49> (201) 723-5964
> 
> 
> 








  • Prev by Date: Re: Question in ParametricPlot
  • Next by Date: FWD: Pentium bug !! (THAT'S A PC...) (fwd)
  • Previous by thread: ListContourPlot for irregular sampling
  • Next by thread: Response to VectorAnalysis