Hi,
rgl plots seem to require the z object in the form of a matrix. I would like
some help in constructing this matrix when I cannot use the outer function. Let
me explain.
library(rgl)
library(plot3D)
x <- 1:10
y <- 1:20
fun1 <- function (x,y) {x^2+y^2}
z <- outer(x,y, fun1)
open3d()
surface3d(x,y,z,col="red",theta=50, phi=20)
This works fine. However, when I have a data frame of x, y and z with z as a
vector, how do I proceed?
z <- x^2+y^2
> surface3d(x,y,z,col="red",theta=50, phi=20)
Error in surface3d(x, y, z, col = "red", theta = 50, phi = 20) :
At least one coordinate must be a matrix
How do I get z in the form of a matrix?
Thanks.
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.