I would like to use R and have it consume the few X,Y,Z points of data that I have (the black dots in the image) and then generate 300x300 XYZ points that would represent the 3D Surface Plot seen colored in the image. I would like the output to simple be three columns, the X,Y, and Z points. I've tried the following, but it doesn't seem to generate the data I need. I need the X,Y,Z points to generate an image in another program (spotfire) and do not need to do any graphics in R. Any help would be appreciated! Thanks.
> require(akima)
> points = read.csv("points.csv", header = TRUE)
> print(points)
x y z
1 400.01 650.01 2.70
2 150.00 780.00 3.40
3 250.00 780.00 3.10
4 800.00 700.00 1.00
5 1000.00 680.00 1.00
6 1500.00 680.00 0.75
7 1700.00 700.00 1.00
8 1700.00 790.00 1.25
9 1600.00 1000.00 1.20
10 1750.00 1000.00 1.00
11 1800.00 1650.00 0.60
12 1400.00 1650.00 0.65
13 1000.00 1650.00 0.80
14 500.00 1650.00 0.90
15 150.00 1650.00 1.30
16 150.00 1050.00 3.90
17 500.00 1000.00 3.00
> s=interp(points$x,points$y,points$z,xo=seq(min(points$x),max(points$x),length=300),yo=seq(min(points$y),max(points$y),length=300))
It works for me. I think all you need to do is transform the final list into a matrix.
s1 <- interp2xyz(s)
dim(s1)
# [1] 90000 3
A lot of points generate a NA values for z value
sum(is.na(s1[,3]))
# [1] 4897
You might choose to exclude those points or use extrapolation.