Draws a triangular mesh (mesh3d) colored according to a continuous
scale associated with a vector of values s (via rgl::shade3d()),
automatically adding a color-bar legend (via splot3d()).
Usage
sshade3d(
x,
s,
meshColor = c("faces", "facesvertices", "vertices"),
slim = range(s, finite = TRUE),
col = jet.colors(128),
legend.zoom = 0.4,
legend.width = 0.1,
legend.mar = 0.15,
legend.lab = NULL,
box = TRUE,
lab.breaks = NULL,
lab.ticksize = 0.5,
lab.dist = 3,
add = FALSE,
...
)Arguments
- x
triangular mesh (
mesh3dobject, seergl::mesh3d()).- s
values used to color the mesh. How they are interpreted depends on
meshColor.- meshColor
determines how material colours (and textures) are interpreted:
"faces"applies the color per face;"facesvertices"assumes thatscontains one value per vertex, calculates the average per face (viavb2tri()), and applies the resulting color to each face;"vertices"applies the color per vertex. Seergl::shade3d().- slim
limits (vector of length 2 with the minimum and maximum) used to set up the color scale.
- col
color table used to set up the color scale. Defaults to
jet.colors(128).- legend.zoom
zoom factor applied to the legend subscene (see
rgl::view3d()).- legend.width
relative width of the color bar, as a fraction of the corresponding dimension of the legend subscene/panel.
- legend.mar
relative width of the legend panel, as a fraction of the total device width.
- legend.lab
legend title.
- box
logical; if
TRUE(the default) a rectangle is drawn around the color bar.- lab.breaks
labels for the legend axis breaks; if
NULLthey are generated automatically (seeaxis3()).- lab.ticksize
length of the legend axis tick marks, as a fraction of the distance to the center of the legend panel.
- lab.dist
distance between the tick marks and the labels of the legend axis, as a multiple of
lab.ticksize.- add
logical; if
TRUEthe legend is not redrawn (useful for adding several meshes to an already existing legend).- ...
additional arguments passed 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.