panel.3d.contour: Lattice Panel for Draw Contour Lines In Wireframe Plots

Description Usage Arguments Author(s) See Also Examples

View source: R/panel.3d.contour.R

Description

Used to superpose contour lines at the bottom, top or on the surface of a wireframe.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
panel.3d.contour(
  x,
  y,
  z,
  rot.mat,
  distance,
  type = c("on", "top", "bottom"),
  nlevels = 20,
  levels = NULL,
  zlim.scaled,
  zlim,
  col.contour = 1,
  ...
)

Arguments

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 top, bottom and/or on. Can be use more than one.

nlevels

the same argument defined in wireframe().

levels

the same argument defined in wireframe().

col.contour

color of the contour lines.

Author(s)

Walmes Zeviani, walmes@ufpr.br, based on the messages to the R-help mailing list.

See Also

wireframe().

Examples

 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)

walmes/wzRfun documentation built on Aug. 10, 2021, 2:19 p.m.