This function draws a perspective plot of a surface with different levels in different colors.

1 2 3 4 5 6 | ```
persp3D(x, y, z, theta = 30, phi = 20, d = 5, expand = 2/3,
xlim = range(x, finite = TRUE), ylim = range(y, finite = TRUE),
zlim = range(z, finite = TRUE), levels = pretty(zlim, nlevels),
nlevels = 20, color.palette = jet.colors, border = NA,
ticktype = "detailed", xlab = NULL, ylab = NULL, zlab = NULL,
...)
``` |

`x, y` |
locations of grid lines at which the values in |

`z` |
a matrix containing the values to be plotted (NAs are allowed). |

`theta, phi` |
angles defining the viewing direction. |

`d` |
a value which can be used to vary the strength of the perspective transformation. |

`expand` |
a expansion factor applied to the |

`xlim, ylim, zlim` |
x-, y- and z-limits for the axes. |

`levels` |
a vector of values specifying the levels to be used for plotting the surface with different colors. |

`nlevels` |
a value specifying the numbe of levels to be used for plotting. This value is used if |

`color.palette` |
the color palette used for plotting. |

`border` |
the color of the line drawn around the surface facets. By default is set to |

`ticktype` |
a character specifying the type of axes tickmarks. By default |

`xlab, ylab, zlab` |
character strings specifying the titles for the axes. |

`...` |
Further arguments passed to the function |

This function enhances the default perspective plot for drawing 3-dimensional surfaces.

Return a list with the following elements:

`persp` |
the viewing transformation matrix (see |

`levels` |
a vector of values giving the levels used for plotting the surface; |

`colors` |
a vector of strings giving the color used for plotting the surface. |

Luca Scrucca

1 2 3 4 5 6 7 8 9 10 11 | ```
y <- x <- seq(-10, 10, length=60)
f <- function(x,y) { r <- sqrt(x^2+y^2); 10 * sin(r)/r }
z <- outer(x, y, f)
persp3D(x, y, z, theta = 30, phi = 30, expand = 0.5)
persp3D(x, y, z, color.palette = heat.colors, phi = 30, theta = 225,
box = TRUE, border = NA, shade = .4)
x1 = seq(-3,3,length=50)
x2 = seq(-3,3,length=50)
y = function(x1, x2) sin(x1)+cos(x2)
persp3D(x1, x2, outer(x1,x2,y), zlab="y", theta = 150, phi = 20, expand = 0.6)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.