rrglr-car

How to format labels of points in car::scatter3d?


I'm trying to create a 3D scatter plot of a planetary group, each body properly labeled. The next code creates the plot I need.

with(bpmg, {
    car::scatter3d(x = X, y = Y,z = Z, 
              surface = FALSE, 
              point.col = color,
              labels = Name,
              id.n = nrow(bpmg))
})

enter image description here

I cannot find in the documentation, however, a way to format the labels of each planet in such a way they don't have that size and/or color. Is there anything I can do?


Solution

  • I don't know the scatter3d function, but if you used rgl's plot3d and text3d it's fairly straightforward. For example,

    with(bpmg, {
        rgl::plot3d(x = X, y = Y,z = Z, col = color)
        rgl::text3d(x = X, y = Y, z = Z, col = othercolor, adj = c(0,0),
                    cex = 2)
    })
    

    This is untested (you didn't include any data in your question).