Re: [R] constructing a matrix for rgl plots

2025-05-31 Thread Duncan Murdoch
The akima package has a somewhat problematic license (the ACM license, which doesn't allow commercial use). The interp package provides some of the same functionality but is free open source. rgl has some support for output from interp. I forget if it would also work with akima. Duncan On

Re: [R] constructing a matrix for rgl plots

2025-05-31 Thread Ben Bolker
I'll mention that the 'akima' package is also handy for this kind of interpolation. On 5/31/25 11:18, Duncan Murdoch wrote: On 2025-05-31 7:04 a.m., ravi via R-help wrote: Hi, rgl plots seem to require the z object in the form of a matrix. I would like some help in constructing this matrix

Re: [R] constructing a matrix for rgl plots

2025-05-31 Thread Duncan Murdoch
On 2025-05-31 7:04 a.m., ravi via R-help wrote: 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

Re: [R] constructing a matrix for rgl plots

2025-05-31 Thread Jeff Newmiller via R-help
In the general case you cannot do that... you have to choose a way to interpolate your data points from a known x,y partition like your first example (your interpolation gets used as "f"). In the special case where your points in the data frame were generated as a grid, then you should still ha

[R] constructing a matrix for rgl plots

2025-05-31 Thread ravi via R-help
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