[R] 3-D interpretation
Ben Bolker
bbolker at gmail.com
Wed Dec 11 16:24:26 CET 2013
Shane Carey <careyshan <at> gmail.com> writes:
>
> it just keeps crashing on me,
>
> It seems to crash on this line
>
> rgl.surface(akima.li$x,akima.li$y,akima.li$z,color="green",alpha=c(0.5))
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))
More information about the R-help
mailing list