[R] interp() function output not continue

From: Dieter Vanderelst <dieter_vanderelst_at_emailengine.org>
Date: Tue, 17 Jun 2008 15:52:55 +0200


Dear List,

I'm using interp() to prepare 3d data for plotting with the contour() function.

If have x,y and z data. All are arrays. X and Y are sampled in an orderly fashion on a grid (a circular sub-area of a grid - see plot). I'm trying to use interp() to get x and y arrays and a z matrix that can be fed to contour().

This is the command: interp(x,y,z,extrap=F,linear=FALSE,duplicate='mean')

In the result there are, consistently, some discontinuities. This happens always in the 'middle' of the data.

I've uploaded a plot that might clarify the problem: http://examples.attic.sent.com/example.png

As you can see the middle of the plot is discontinue. When I look at the data, there is no particular reason why this should happen.

The problem seems to be a single row in the z matrix returned by interp() right in the middle of the matrix (line 30 of 60). Replacing this line with the mean of row 29 and 31 seems to solve the problem. This results in this plot: http://examples.attic.sent.com/example_fix.png. This works, but it is not nice of course.

Is this something that looks familiar to someone? Can I replace the interp() function with something else? Could this be due to the particular way my data is sampled?

Regards,
Dieter



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 17 Jun 2008 - 14:06:22 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 Tue 17 Jun 2008 - 15:00:48 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.

list of date sections of archive