3D surface plot in R
I am trying to create a 3D plot in R-Project. I know there was a question like this before, but I couldn't solve my problems with the answers there.
I have:
Vdot_L = c(0,1,2,3,4,5,6,7,8,9,10)
Qdot_verd = c(2000,2100,2200,2300,2400,2500,2600,2700,2800,2900,3000)
zeta_ex = 0.4
T_U = 293.15 #K
T_verd = 273.15 #K
T_cond=Vdot_L*2+T_U
epsilon_k = zeta_ex * T_verd/(T_cond - T_verd)
Pfun <- function(a,b) {a/b}
P <- outer(Qdot_verd, epsilon_k, FUN="Pfun")
What I would like to create is a colored surface with Vdot_L
on the x-axis, Qdot_verd
on the y-axis and P
on the z-axis. I need help for this.
source to share
Have you researched the Plot3D package?
http://cran.r-project.org/web/packages/plot3D/plot3D.pdf
There is a method called here surf3d
that seems to do what you want. After importing the package, enter the values ββinto the matrix and write:
surf3d(Vdot_L, Qdot_verd, P)
There is also a color parameter that you can tweak.
Alternatively use rgl and avoid the matrix problem:
rgl.surface(Vdot_L, Qdot_verd, P)
Also check out these posts for more information: R: 3D Surface Plot from 2D Matrix How to Create 3D MATLAB Style - Graphics Objects in R
source to share