Skip to content
Prev 334292 / 398502 Next

3-D interpretation

Shane Carey <careyshan <at> gmail.com> writes:
When I run the code you gave us along with the data you gave us,
I get

Error in rgl.surface(akima.li$X, akima.li$Y, akima.li$Z, color = "green",  : 
  rows < 2

  Maybe this is what you mean by "crashing"?  (On this list, "crash"
is usually reserved to mean that your instance of R stops abruptly ...
the behaviour above would be called an "error").

  Looking at the plot generated from the data you sent, all of
the (X,Y) points lie on a 1-dimensional curve in the (X,Y) plane --
it's not surprising that it's going to be hard to generate an
interpolated surface from these points.

  Or maybe I'm misunderstanding something.

rgl.spheres(dat$X,dat$Z , dat$Y,1,color="red")
rgl.bbox()
# bivariate linear interpolation
# interp:
akima.li <- interp(dat$X, dat$Y, dat$Z,
                   xo=seq(min(dat$X), max(dat$X), length = 100),
                   yo=seq(min(dat$Y), max(dat$Y), length = 100))
# interp surface:
rgl.surface(akima.li$X,akima.li$Y,akima.li$Z,color="green",alpha=c(0.5))