0

I've been trying to plot a 3d mesh with colors in plotly and but the face colors keep being assigned incorrectly.

library(plotly)
library(Rvcg)

# example mesh
plyFile <- 
"https://www.dropbox.com/sh/c3bcbr6y9lidggg/AAD2cWFZEZczBIMXT0vdyGoia?dl=0?
raw=1"
download.file(plyFile, "Ellipsoid_colour.ply")

# plot 3d mesh
mesh <-vcgImport("Ellipsoid_colour.ply", readcolor = TRUE)
facecolor <- mesh$material
plot_ly(
  x = mesh$vb[1, ], y = mesh$vb[2, ], z = mesh$vb[3, ],
  i = mesh$it[1, ] - 1, j = mesh$it[2, ] - 1, k = mesh$it[3, ] - 1,
  facecolor = toRGB(facecolor$color),
  type = "mesh3d"
)

It should be like this- enter image description here But displays as this- enter image description here Does anyone know how to fix this?

MLavoie
  • 9,671
  • 41
  • 36
  • 56
telfer
  • 15
  • 3

0 Answers0