Draws a triangular mesh (mesh3d) colored according to the levels of a
factor f, and (optionally) adds a categorical legend (via
fplot3d()).
Usage
fshade3d(
x,
f,
meshColor = c("faces", "vertices"),
col = hcld.colors(nlevels(f)),
legend = TRUE,
legend.type = c("s", "c", "p", "l"),
legend.zoom = 0.6,
legend.width = 0.2,
legend.size = 4,
legend.dim = 0.2,
legend.lab = NULL,
lab.dist = 2.5,
lab.rev = 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()).- col
vector of colors associated with each level of
f(defaults tohcld.colors(nlevels(f))).- legend
logical; if
TRUE(default), the active rgl device is splitted into two subscenes, drawing the 3D mesh object in one and the categorical legend in the other (seefplot3d()). ifFALSEonly the (coloured) mesh is drawn and the arguments related to the legend are ignored (fplot3d()is not called).- legend.type
character; symbol/object used to represent each level in the legend (see
typeinfplot3d()):"s"for spheres (default),"c"for cubes,"p"for points, or"l"for (horizontal) line segments.- legend.zoom
zoom factor applied to the legend subscene/panel.
- legend.width
relative size of the legend symbols (spheres, cubes or line segments), as a fraction of the corresponding dimension of the legend subscene.
- legend.size
point size, if
type = "p", or line width, iftype = "l"(in pixels; seesizeandlwdgraphical parameters inrgl::par3d(); ignored in all other cases).- legend.dim
relative dimension of the legend panel, as a fraction of the full width (or height) of the device.
- legend.lab
label for the axis of the color legend, defaults to a description of
f.- lab.dist
distance between the legend symbols and their text labels, as a multiple of the symbol size (
legend.width).- lab.rev
logical; if
TRUEthe order of the levels in the legend is reversed (by default they are shown from top to bottom).- ...
additional arguments passed on to
rgl::shade3d().
Value
Called for its side effect (draws the mesh and, unless legend = FALSE,
the legend on the active rgl device); invisibly returns the object identifiers.