Pacific-Design.com

    
Home Index

1. R Langauge

2. 3D Plot

R Langauge / 3D Plot /

3D Plot in R Language


library(rgl)
library(akima);
x=runif(1000)
y=runif(1000)
z=abs(rnorm(1000))
s=interp(x,y,z)
dim(s$z)
surface3d(s$x,s$y,s$z)

x <- seq(-10, 10, length.out = 50)  
y <- x  
rotsinc <- function(x,y) {
  sinc <- function(x) { y <- sin(x)/x ; y[is.na(y)] <- 1; y }  
  10 * sinc( sqrt(x^2+y^2) )  
}

z <- outer(x, y, rotsinc)  
persp(x, y, z)
surface3d(x, y, z)

library(lattice)