1

I have a data frame with XYZ, coordinates, and several other vectors e.g. amplitude of signal etc. see below head(data)

 Point back.compat point.index back.compat2       x         y       z
1     P           0           3            0 27.0517 -43.13530 196.112
2     P           0           4            0 33.6436 -31.92700 193.627
3     P           0           5            0 37.8914 -22.59280 191.426
4     P           0           6            0 41.4369 -13.01710 188.994
5     P           0           7            0 44.8093  -3.40489 186.449
6     P           0           8            0 24.2484 -34.95670 202.826
  alpha.of.point beta.of.point gamma.of.point   uni    bi lat  imped
1       0.534786      0.824073      -0.186834 5.997 5.028   3 -10000
2       0.449660      0.871231      -0.196880 7.206 1.671  -3 -10000
3       0.365726      0.903938      -0.221677 7.443 1.311  -3 -10000
4       0.324984      0.914938      -0.239318 8.244 5.901   8 -10000
5       0.320455      0.916345      -0.240041 8.589 1.809  14 -10000
6       0.720051      0.667935      -0.188118 6.954 1.269  -1 -10000
  X.Point.Type... Label.ID point.size point.label label.colour cath.id
1               0       -1          1           A            0     587
2               0       -1          1           A            0     587
3               0       -1          1           A            0     587
4               0       -1          1           A            0     587
5               0       -1          1           A            0     587
6               0       -1          1           A            0     587
  is.te      v
1     0 -10000
2     0 -10000
3     0 -10000
4     0 -10000
5     0 -10000 

i use

tc.xyz <- delaunayn(xyz, options="PG")

to make the mesh for xyz

then

open3d()
tetramesh(tc.xyz, xyz, alpha=1, col=2)

to plot

but now i want the colour scaled as a contour of "bi" in my original dataframe. how do i do that?

zx8754
  • 52,746
  • 12
  • 114
  • 209
user3715775
  • 127
  • 8
  • You may get a better response if you provide a reproducible example. You need to include all packages used (if not included in vanilla R) and provide data in easily pasted format (like `dput()`). – Roman Luštrik Dec 17 '15 at 17:54
  • nstall.packages("geometry") install.packages("akima") install.packages("scatterplot3d") install.packages("plot3D") library(rgl) library(geometry) require(akima) library(scatterplot3d) library(plot3D) – user3715775 Dec 17 '15 at 20:21
  • data frame is too big sorry – user3715775 Dec 17 '15 at 20:24
  • basically you have about 1000+ x,y,z coordinates, these are used to make a tertamesh shape. now for the colour i need to overlay a contour map of the vector "bi" onto the tertamesh. the contour map needs to based on the scale of "bi", so red if "bi" <0.5, yellow of <1.5 and green if >1.5. those colours need to pe placed onto the tetramesh – user3715775 Dec 17 '15 at 20:24
  • Please edit your question and include the information there. I think you need to invest some more time to think of how to convey your problem to us. [Here are a few tips](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – Roman Luštrik Dec 17 '15 at 21:05
  • It's all there. How do you add contour colouring to a tetramesh in R? – user3715775 Dec 17 '15 at 21:08
  • Xyz from data frame was used to form a tetramesh using rgl in R – user3715775 Dec 17 '15 at 21:09
  • You will get a better response rate if you pack your code into a neat little chunk we can copy/paste into our R session and work from there. Please see my first comment and in addition, you can check the guidelines on how to ask a good question [here](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – Roman Luštrik Dec 17 '15 at 21:16
  • I'm a bit confused xyz are in the data frame. You can take any xyz you like and make a delauny. And then do the tetramesh as per my code (very standard). My point is that every xyz has a vector "bi" assigned in the data frame. How would you scale the colour of the trimesh based on the value of the vector "bi" – user3715775 Dec 17 '15 at 21:18
  • points3d(xyz[tbr,1], xyz[tbr,2], xyz[tbr,3], col = ifelse(data$bi < 0.5,'red','green'), alpha=10). WOULD BE THE CODE IF YOU DID IT WITH POINTS ONLY. BUT HOW TO OVERLAY ONTO A TETRAMESH? – user3715775 Dec 18 '15 at 10:57

0 Answers0