0

I am quite new in R language and I finally have been able to make a surface with the fallowing code:

drilling_trial<- read.table("DRILLING_TRIAL.csv",header=TRUE,sep=",")
all_pit_data<- read.table("ALL_PIT_DATA.csv",header=TRUE,sep=",")
require("akima")
s <- with(all_pit_data,interp(x1,y1,z1))
library("rgl")
plot3d(drilling_trial$x,drilling_trial$y,drilling_trial$z, col = drilling_trial$d, add = FALSE, axes = TRUE, bbox = TRUE, xlab="x", ylab="y", zlab="z")
surface3d(s$x,s$y,s$z,col="gray")

Bynow, my surface is gray but I would like to color it with shaded off color (gradation) depending on the z position. Someone have an idea on how to do so?

Thank you,

Sim

chepasim
  • 81
  • 7
  • 1
    Does http://stackoverflow.com/questions/3786189/r-4d-plot-x-y-z-colours help? – csgillespie Jan 09 '14 at 20:59
  • Tanks, I got some color gradation but nothing related to the z value. What I would like is to by able to separate my z (height) in say 10 sections and make it easy to change to any number of sections. Then, having a color gradation of those "horizontal slices". – chepasim Jan 10 '14 at 18:10

1 Answers1

2

I try a couple of things and I ended up with this giving me pretty much what I wanted:

cols <- terrain.colors(462)
surface3d(s$x,s$y,s$z,color=cols[s$z])

462 being the higher of my z values! Thank you csgillespie for the link provided... I started from there!

chepasim
  • 81
  • 7