plotSurface3D | R Documentation |
Convenient wrapper for visualizing a real function of three variables by means of a colour scale and alpha shading.
plotSurface3D(x = seq_len(nrow(t)), y = seq_len(ncol(t)),
z = seq_len(dim(t)[3]), f, t = NULL, nLev = 20, levels = NULL,
fVect = FALSE, size = 15, alpha = 0.05, ...)
x , y , z |
numerical grids for each dimension. |
f |
function to be plot. Must take a single argument (see examples). |
t |
a vector of length |
nLev |
number of levels in the colour scale. |
levels |
vector of breaks in the colour scale. If not provided, it is
set to |
fVect |
flag to indicate whether |
size |
size of points in pixels. |
alpha |
alpha value between |
... |
further arguments passed to |
The vector t
, invisible.
if (requireNamespace("rgl")) {
x <- seq(-pi, pi, l = 50)
f <- function(x) 10 * (sin(x[, 1]) * cos(x[, 2]) - sin(x[, 3]))^2
t <- plotSurface3D(x, x, x, size = 10, alpha = 0.01, fVect = TRUE, f = f)
plotSurface3D(x, x, x, t = t, size = 15, alpha = 0.1,
levels = quantile(t, probs = seq(0, 0.1, l = 20)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.