Create 3d surface plot using persp in R -
i want generate 3d surface plot using “persp”. have 25 x , y coordinates:
x<-c(-3.5,-2.5,-1.5,-0.5,0.5,1.5,2.5,3.5,-4,-3,-2,-1,0,1,2,3,4,-3.5,-2.5,-1.5,-0.5,0.5,1.5,2.5,3.5) y<-c(1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1)
and accordingly 25 z coordinates:
z<-c(7.25e-08,1.20e-07,1.26e-07,1.26e-07,1.58e-07,6.93e-08,1.29e-07,9.57e-08,7.59e-08,1.59e-08,8.75e-08,1.37e-07,2.08e-07,1.41e-07,1.40e-07,9.46e-08,6.90e-08,7.41e-08,8.84e-08,1.21e-07,2.09e-07,1.80e-07,1.19e-07,9.31e-08,7.79e-08)
i want have plot every z-value set @ it´s location (x,y). learned
persp(x,y,z)
does not work. easiest way?
according persp
documentation, need increasing values x
, y
. not possible data.
when need draw discrete surface 3
vector of equal lengths, should rather go rgl
:
library(rgl) plot3d(x,y,z)
Comments
Post a Comment