R中的3D表面图 [英] 3D surface plot in R
本文介绍了R中的3D表面图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在R-Project中创建3D图.我知道以前有一个类似的问题,但是我无法用那里的答案解决我的问题.
I'm 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.
我所拥有的是:
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")
我要创建的是一个彩色表面图,其中x轴上为Vdot_L
,y轴上为Qdot_verd
,z轴上为P
.我非常感谢您的帮助.
What I'd like to create is a colored surface plot with Vdot_L
on the x-Axis, Qdot_verd
on the y-Axis and P
on the z-Axis. I'm thanful for every help.
推荐答案
是这样的吗?
library(rgl)
zlim <- range(P,na.rm=T)
zlen <- zlim[2] - zlim[1] + 1
color.range <- rev(rainbow(zlen)) # height color lookup table
colors <- color.range[P-zlim[1]+1] # assign colors to heights for each point
persp3d(Vdot_L, Qdot_verd, P, col=colors)
这篇关于R中的3D表面图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文