填充 3D 图中两个线段之间的区域 {rgl}
Fill area between two segments in a 3D plot {rgl}
我使用包 {rgl} 中的函数 plot3d() 使用顶点坐标和线段制作了一个四面体。下面的代码使 mentioned plot
library("rgl")
CCl4=c(5,5,5,10)
Luminol=c(0.01,0.001,0.005,0.005)
Na2CO3=c(0.01,0.01,0.1,0.05)
plot3d( Luminol, Na2CO3, CCl4, type = "s")
for(i in 1:4){
for(k in 1:4){
segments3d(x=Luminol[c(i,k)],y=Na2CO3[c(i,k)],z=CCl4[c(i,k)])
}
}
现在,我想填充点之间的区域(最好使用 RGB 颜色,这样我可以使用 alpha 值定义透明度)但我没有在 rgl 中找到类似 polygon() 的函数。有没有办法填充这个区域?
提前致谢。
这是您要找的吗?对请求并不完全清楚。我给所有东西都加了颜色来帮助弄清楚。
library("rgl")
CCl4=c(5,5,5,10)
Luminol=c(0.01,0.001,0.005,0.005)
Na2CO3=c(0.01,0.01,0.1,0.05)
clrs <- c("red","blue","green","darkgrey")
plot3d( Luminol, Na2CO3, CCl4, type = "s",col=clrs)
for(i in 1:4){
clr <- clrs[i]
for(k in (i+1):4){
v <- c(i,k)
segments3d(Luminol[v],Na2CO3[v],CCl4[v],color=clr)
}
}
for (i in 1:4){
clr <- clrs[i]
v <- setdiff(1:4,i)
triangles3d(Luminol[v],Na2CO3[v],CCl4[v],alpha=0.5,col=clr)
}
产量:
我使用包 {rgl} 中的函数 plot3d() 使用顶点坐标和线段制作了一个四面体。下面的代码使 mentioned plot
library("rgl")
CCl4=c(5,5,5,10)
Luminol=c(0.01,0.001,0.005,0.005)
Na2CO3=c(0.01,0.01,0.1,0.05)
plot3d( Luminol, Na2CO3, CCl4, type = "s")
for(i in 1:4){
for(k in 1:4){
segments3d(x=Luminol[c(i,k)],y=Na2CO3[c(i,k)],z=CCl4[c(i,k)])
}
}
现在,我想填充点之间的区域(最好使用 RGB 颜色,这样我可以使用 alpha 值定义透明度)但我没有在 rgl 中找到类似 polygon() 的函数。有没有办法填充这个区域?
提前致谢。
这是您要找的吗?对请求并不完全清楚。我给所有东西都加了颜色来帮助弄清楚。
library("rgl")
CCl4=c(5,5,5,10)
Luminol=c(0.01,0.001,0.005,0.005)
Na2CO3=c(0.01,0.01,0.1,0.05)
clrs <- c("red","blue","green","darkgrey")
plot3d( Luminol, Na2CO3, CCl4, type = "s",col=clrs)
for(i in 1:4){
clr <- clrs[i]
for(k in (i+1):4){
v <- c(i,k)
segments3d(Luminol[v],Na2CO3[v],CCl4[v],color=clr)
}
}
for (i in 1:4){
clr <- clrs[i]
v <- setdiff(1:4,i)
triangles3d(Luminol[v],Na2CO3[v],CCl4[v],alpha=0.5,col=clr)
}
产量: