Is there a way to have the names shown when use plot3d(rgl) in R to build a 3d graph, cause it's hard to locate which entry the sphere belongs to when I have many spheres to plot on the same coordinate. For example, I have the data:
x y z
A 0.1 -0.5 3.2
B -1.1 1.2 0.8
C 2.0 2.1 0.6
......
plot3d(data,type="s",radius=0.025)
But, I want to have the name A, B, C shown on the graph as it's easier to observe. Or to have the name shown only when I put the mouse onto one specific sphere. I have tried to use different colors, but when I have like 20 spheres, it seems it will run out of colors or colors are too close to distinguish.
There is a function text3d()
in library rgl
that can be used to plot texts inside plot. This example shows how to plot row names as texts.
plot3d(data,type="s",radius=0.025)
text3d(data$x,data$y,data$z,text=rownames(data))