R/function_plot3D.R

Defines functions plot3D

Documented in plot3D

#'Function of 'Plot Three Dimensional Graph'
#'
#'@param x,y Numeric vectors
#'@param f A function
#'
#'@return a three dimensional graph
#'
#'@examples
#'x <- seq(-10, 10, length = 30)
#'y <- x
#'f <- function(x, y){r <- sqrt(x ^ 2 + y ^ 2);10 * sin(r) / r}
#'plot3D(x, y, f)
#'
#'@export

plot3D <- function(x, y, f){
  z <- outer(x, y, f)
  z[is.na(z)] <- 1
  op <- par(bg = 'white')
  persp(x, y, z, theta = 30, phi = 30, expand = 0.5, col = 'light blue')
}
zhaoxue-xmu/RDA documentation built on May 4, 2019, 10:17 p.m.