plotLegend {RRmorph}R Documentation

Plot legend for colored mesh.

Description

Assuming a mesh is colored according to a vector of values, the function takes the color sequence from the mesh and plots it associated to values.

Usage

plotLegend(mesh,values,main)

Arguments

mesh

a mesh3d object

values

a vector of continuous values associated to individual vertices of the mesh.

main

plot title.

Value

A plot of the color sequence associated to values on the mesh.

Author(s)

Marina Melchionna, Silvia Castiglione

Examples

  
  da<-"https://github.com/pasraia/RRmorph_example_data/raw/refs/heads/main/RRmorphdata.rda"
  download.file(url=da,destfile = paste0(tempdir(),"/RRmorphdata.rda"))
  load(paste0(tempdir(),"/RRmorphdata.rda"))

  require(rgl)
  require(Morpho)
  require(Rvcg)

  pca<-procSym(endo.set)
  ldm<-endo.set[,,"Homo_sapiens"]
  sur<-endo.sur[["Homo_sapiens"]]

  rec<- vcgBallPivoting(pca$mshape, radius = 0)
  rec$vb[1:3,]<-t(ldm)
  val<-rnorm(ncol(rec$vb))

  interp<-interpolMesh(sur = rec,refsur = sur,refmat = ldm,
                       values = val,element ="vertices",k = 4)

  colmesh<-col2mesh(mesh = sur,values = interp,pal = heat.colors(5))
  plotLegend(mesh = colmesh,values = interp, main = "Pan troglodytes")
  open3d()
  shade3d(colmesh,specular="black")
  

[Package RRmorph version 0.0.1 Index]