'I can not see the 3d figure when using r function persp3d
I can not see the 3d figure when using r function persp3d, like using this demo code, it does not appear andy 3d graph, is it because the version of R?
# (1) The Obligatory Mathematical surface.
# Rotated sinc function.
x <- seq(-10, 10, length = 20)
y <- x
f <- function(x, y) { r <- sqrt(x^2 + y^2); 10 * sin(r)/r }
z <- outer(x, y, f)
z[is.na(z)] <- 1
open3d()
# Draw the surface twice: the first draws the solid part,
# the second draws the grid. Offset the first so it doesn't
# obscure the lines.
persp3d(x, y, z, aspect = c(1, 1, 0.5), col = "lightblue",
xlab = "X", ylab = "Y", zlab = "Sinc( r )",
polygon_offset = 1)
persp3d(x, y, z, front = "lines", back = "lines",
lit = FALSE, add = TRUE)
highlevel() # trigger the plot
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|