有谁知道一种方法:1)完成grid3d
的y
调用中丢失的网格线,2)绘制水平网格线以关闭由grid3d
和x
的y
调用构造的网格的顶部?我试过了pretty
中的grid3d
调用的各种组合,但无济于事,我想知道这是rgl
的怪癖还是我的规范错误。另外,我想将垂直轴编号扩展到封闭的网格最终所处的位置。
library(rgl)
cpts <- seq(0, 2, length = 40)
spts <- seq(0, 1, length = 20)
grid <- expand.grid(s=spts, c=cpts)
UFn <- function(s,c){c^(0.5) - exp(s) + 1}
U <- UFn(grid$s, grid$c)
open3d()
rgl.surface(x = spts, y = matrix(U,nrow = 40, ncol = 20), z = cpts,
coords = c(1,3,2), specular = "black")
axes3d("x", at = pretty(spts, n = 2), color = "black")
axes3d("y", at = pretty(cpts, n = 5), color = "black")
axes3d("z--", color = "black")
grid3d("x")
grid3d("y", at = pretty(spts, n = 2))
title3d(xlab ='s', ylab = 'c', zlab = 'U', color = "black")
rgl.snapshot("3d.png")
最佳答案
我会说这是一个错误。即使使用grid3d("y",n=2)
,您也不会看到任何z线。您可以通过使用at的列表规范来解决它,设置列表的x元素,例如:
grid3d("y", at = list(x=pretty(spts, n = 2)))