Draws a triangular mesh (mesh3d) colored according to the levels of a
factor f, automatically adding a categorical legend (via
fplot3d()).
Usage
fshade3d(
x,
f,
meshColor = c("faces", "vertices"),
labels = levels(f),
col = hcld.colors(length(labels)),
legend.zoom = 1,
legend.width = 0.1,
legend.mar = 0.15,
legend.lab = NULL,
lab.dist = 3,
lab.rev = FALSE,
add = FALSE,
...
)Arguments
- x
triangular mesh (
mesh3dobject, seergl::mesh3d()).- f
factor used to color the mesh. How its values are interpreted depends on
meshColor.- meshColor
determines how color is applied to the mesh:
"faces"or"vertices"(seergl::shade3d()).- labels
legend labels (defaults to
levels(f)).- col
vector of colors associated with each level of
f(by default generated withcol.pal).- legend.zoom
zoom factor applied to the legend subscene/panel
- legend.width
relative size of the legend spheres, as a fraction of the corresponding dimension of the legend subscene.
- legend.mar
relative width of the legend panel, as a fraction of the total device width.
- legend.lab
legend title.
- lab.dist
distance between the spheres and their text labels.
- lab.rev
logical; if
TRUEthe order of the levels in the legend is reversed (by default they are shown from top to bottom).- add
logical; if
TRUEthe legend is not redrawn (useful for adding several meshes to an already existing legend).- ...
additional arguments passed on to
rgl::shade3d().
Value
Called for its side effect (draws the mesh and, unless add = TRUE,
the legend on the active rgl device); invisibly returns the object identifiers.