我试图让 R 的 scatterplot3d 包在烧杯笔记本中呈现,但无法让它工作。我可以正常运行代码,但不显示图形。将 scatterplot3d 输出设置为变量并打印变量得到:
输入:
data(iris)
test <- scatterplot3d(iris[,1:3])
test
输出:
$xyz.convert
function (x, y = NULL, z = NULL)
{
xyz <- xyz.coords(x, y, z)
if (angle > 2) {
temp <- xyz$x
xyz$x <- xyz$y
xyz$y <- temp
}
y <- (xyz$y - y.add)/y.scal
return(list(x = xyz$x/x.scal + yx.f * y, y = xyz$z/z.scal +
yz.f * y))
}
<environment: 0x00000000048f8830>
$points3d
function (x, y = NULL, z = NULL, type = "p", ...)
{
xyz <- xyz.coords(x, y, z)
if (angle > 2) {
temp <- xyz$x
xyz$x <- xyz$y
xyz$y <- temp
}
y2 <- (xyz$y - y.add)/y.scal
x <- xyz$x/x.scal + yx.f * y2
y <- xyz$z/z.scal + yz.f * y2
mem.par <- par(mar = mar, usr = usr)
on.exit(par(mem.par))
if (type == "h") {
y2 <- z.min + yz.f * y2
segments(x, y, x, y2, ...)
points(x, y, type = "p", ...)
}
else points(x, y, type = type, ...)
}
<environment: 0x00000000048f8830>
$plane3d
function (Intercept, x.coef = NULL, y.coef = NULL, lty = "dashed",
lty.box = NULL, ...)
{
if (!is.atomic(Intercept) && !is.null(coef(Intercept)))
Intercept <- coef(Intercept)
if (is.null(lty.box))
lty.box <- lty
if (is.null(x.coef) && length(Intercept) == 3) {
x.coef <- Intercept[if (angle > 2)
3
else 2]
y.coef <- Intercept[if (angle > 2)
2
else 3]
Intercept <- Intercept[1]
}
mem.par <- par(mar = mar, usr = usr)
on.exit(par(mem.par))
x <- x.min:x.max
ltya <- c(lty.box, rep(lty, length(x) - 2), lty.box)
x.coef <- x.coef * x.scal
z1 <- (Intercept + x * x.coef + y.add * y.coef)/z.scal
z2 <- (Intercept + x * x.coef + (y.max * y.scal + y.add) *
y.coef)/z.scal
segments(x, z1, x + y.max * yx.f, z2 + yz.f * y.max, lty = ltya,
...)
y <- 0:y.max
ltya <- c(lty.box, rep(lty, length(y) - 2), lty.box)
y.coef <- (y * y.scal + y.add) * y.coef
z1 <- (Intercept + x.min * x.coef + y.coef)/z.scal
z2 <- (Intercept + x.max * x.coef + y.coef)/z.scal
segments(x.min + y * yx.f, z1 + y * yz.f, x.max + y * yx.f,
z2 + y * yz.f, lty = ltya, ...)
}
<environment: 0x00000000048f8830>
$box3d
function (...)
{
mem.par <- par(mar = mar, usr = usr)
on.exit(par(mem.par))
lines(c(x.min, x.max), c(z.max, z.max), ...)
lines(c(0, y.max * yx.f) + x.max, c(0, y.max * yz.f) + z.max,
...)
lines(c(0, y.max * yx.f) + x.min, c(0, y.max * yz.f) + z.max,
...)
lines(c(x.max, x.max), c(z.min, z.max), ...)
lines(c(x.min, x.min), c(z.min, z.max), ...)
lines(c(x.min, x.max), c(z.min, z.min), ...)
}
<environment: 0x00000000048f8830>
我不确定 Beaker Notebooks 是否可以实现此功能,但我想我在这里查看是否有人有任何提示。
谢谢,
-pH+