[R] Using Akima with nearly-gridded data

From: Tom Hansen <tomh_at_uwm.edu>
Date: Thu, 07 Jun 2007 12:38:04 -0500

I am using the Akima interpolation package to generate an interpolated color contour plot. It is working very well, except for one problem. The data that I have represents real-time readings from a thermistor string vs. time, so the data points are often very nearly in a rectangular array, since the thermistors are read at regular time intervals and they are equally spaced physically. However, readings are sometimes delayed or missed, so I cannot assume that it will be a regular grid. Hence Akima.

However, Akima simply will not work if the first three points are collinear (which is easy to get around), and it often leaves blank triangles in seemingly arbitrary places in the plot. It seems that the algorithm in Akima for building the triangles that it uses internally to do the interpolation is having a very hard time dealing with nearly regularly-spaced data points.

The only way I have found to get Akima to work, is to slightly "perturb" the data points by adding random seconds to the times (the temperatures are read every 5 minutes, so a few seconds aren't going to matter). More recently I have had some luck simply feeding the points into the algorithm in a pseudo-randomized order. But then, of course, the outcome is largely the luck of the draw and sometimes the plot still ends up with a scattering of white triangles, or artifacts on the edges of the plot.

Does anyone have any suggestions as to how to make this work consistently?

Tom Hansen
Senior Information Processing Consultant
UWM Great Lakes WATER Institute

R-help_at_stat.math.ethz.ch mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 07 Jun 2007 - 17:43:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 07 Jun 2007 - 18:31:36 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.