gpt4 book ai didi

r - 使用 rgl grid3d 补全缺失的行

转载 作者:行者123 更新时间:2023-12-04 02:24:51 25 4
gpt4 key购买 nike

有谁知道 1) 完成 grid3d 中缺失的网格线的方法吗?调用 y , 和 2) 绘制水平网格线以关闭由 grid3d 构建的网格的顶部调用 xy ?我玩过 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")

enter image description here

最佳答案

我会说这是一个错误。使用 grid3d("y",n=2) 时不会得到任何 z 线即使它应该是相同的。您可以通过使用 at 的列表规范来解决它,设置列表的 x 元素,例如:

grid3d("y", at = list(x=pretty(spts, n = 2)))

关于r - 使用 rgl grid3d 补全缺失的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27326360/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com