Package rgl
includes a very useful function ellipse3d
, which can return an ellipsoid that cover like 95% percent of the points in 3D. Then this object can be used in rgl::plot3d
to plot it out. My question is that is it possible to convert the output of ellipse3d
to something that can be plotted through js plotting packages like plotly?
library(rgl)
dt <- cbind(x = rnorm(100), y = rnorm(100), z = rnorm(100))
ellipse <- ellipse3d(cov(dt))
plot3d(dt)
plot3d(ellipse, add = T, color = "red", alpha = 0.5)
Then what can I do to plot the ellipsoid through plotly?