persp3D.Rd
This function draws a perspective plot of a surface with different levels in different colours.
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, col.palette = jet.colors, border = NA,
ticktype = "detailed", xlab = NULL, ylab = NULL, zlab = NULL,
...)
locations of grid lines at which the values in z
are measured. These must be in ascending order. By default, equally spaced values from 0 to 1 are used. If x
is a list, its components x$x
and x$y
are used for x
and y
, respectively.
a matrix containing the values to be plotted (NAs are allowed).
angles defining the viewing direction. theta
gives the azimuthal direction and phi
the colatitude.
a value which can be used to vary the strength of the perspective transformation.
a expansion factor applied to the z
coordinates.
x-, y- and z-limits for the axes.
a vector of values specifying the levels to be used for plotting the surface with different colours.
a value specifying the number of levels to be used for plotting. This value is used if levels
argument is not specified.
the colour palette used for plotting.
the colour of the line drawn around the surface facets. By default is set to NA
so no borders are drawn.
a character specifying the type of axes tickmarks. By default "detailed"
ticks are drawn.
character strings specifying the titles for the axes.
Further arguments passed to the function persp
.
This function enhances the default perspective plot for drawing 3-dimensional surfaces.
Return a list with the following elements:
the viewing transformation matrix (see persp
);
a vector of values giving the levels used for plotting the surface;
a vector of strings giving the colour used for plotting the surface.
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, col.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)