Description Usage Arguments Author(s) See Also Examples
View source: R/panel.3d.contour.R
Used to superpose contour lines at the bottom, top or on the surface of a wireframe.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
x, y, z, rot.mat, distance, zlim.scaled, zlim, ... |
arguments passed to panel.3dwire, the core function of wireframe. |
type |
a string vector. The values allowed are |
nlevels |
the same argument defined in
|
levels |
the same argument defined in
|
col.contour |
color of the contour lines. |
Walmes Zeviani, walmes@ufpr.br, based on the messages to the R-help mailing list.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | library(lattice)
library(latticeExtra)
library(RColorBrewer)
#--------------------------------------------
# Example 1.
# display.brewer.all()
colr <- brewer.pal(11, "RdYlGn")
colr <- colorRampPalette(colr, space = "rgb")
grid <- expand.grid(x = seq(0, 1, by = 0.05),
y = seq(0, 1, by = 0.05))
grid$z <- with(grid, x + y)
wireframe(z ~ x + y, data = grid,
scales = list(arrows = FALSE),
panel.3d.wireframe = panel.3d.contour,
levels = seq(0.5, 1.5, by = 0.1), type = "on",
col.regions = colr(101), drape = TRUE)
#--------------------------------------------
# Example 2.
colr <- brewer.pal(11, "Spectral")
colr <- colorRampPalette(colr, space = "rgb")
grid <- expand.grid(x = seq(-1, 1, by = 0.1),
y = seq(-1, 1, by = 0.1))
grid$z <- with(grid, 1 + 0.01 * x + 0.05 * y -
0.5 * x * y - 0.5 * x^2 - 0.2 * y^2)
wireframe(z ~ x + y, data = grid,
scales = list(arrows = FALSE),
zlim = extendrange(grid$z, f = 0.5),
panel.3d.wireframe = panel.3d.contour,
nlevels = 18, col = "gray30",
type = c("on", "top", "bottom"),
col.regions = colr(101), drape = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.