R using slice3D from plot3D packaging

I am trying to use package

plot3D

to plot my xyz data with color based on 4th variable

My data looks like this:

data.frame(xx,yy,zz,Ammpl)
           xx       yy           zz Ammpl
1    63021.71 403105.0  1.181028516  1170
2    63021.71 403105.0  0.977028516  1381
3    63021.71 403105.0  0.861028516   807
4    63021.71 403105.0  0.784028516   668
5    63021.71 403105.0  0.620028516 19919
6    63021.71 403105.0  0.455028516 32500
7    63021.71 403105.0  0.446028516 32500
8    63021.71 403105.0  0.436028516 32500
9    63021.71 403105.0  0.426028516 32500
10   63021.71 403105.0  0.281028516 17464

      

The first thing I did was use the akima

function from the package interp

. To create a regular grid

s100<-interp(xx,yy,zz, xo=seq(min(xx):max(xx), length=30, yo=seq(min(yy):max(yy), length=30), duplicate="mean")

      

From package plot3D

in function usedslice3D

slice3D(x = s100$x, y = s100$y, z = s100$z,  colvar = ampl, 
ys = 1:10, zs = NULL, NAcol = "black", 
expand = 0.4, theta = 45, phi = 45)

      

My problem is I don't know how to generate the data ampl

for colvar

it to colorize on this graph.

I've tried a lot of things, but I think this is where I get stuck.

As example(slice3D)

they use oxsat$val

of data(oxsat)

to create colvar

.

> dim(Oxsat$val)
[1] 180  90  33

      

+3


source to share





All Articles