简体   繁体   中英

How to join points in Plot3D (rgl) in R

I am trying to make a 3D plot and join the points according only to variable V1 but I am having the following result:

plot3d(Datos$V1,
       Datos$V2,
       Datos$V3,
       type="l",
       xlab="v1",ylab="v2",zlab="v3",
       group.by=Datos$V1,
       col = Datos$V1)

3D绘图

I am trying to remove the diagonal line but I can't seem to find the issue here.

There's no group.by argument to plot3d . You'll need to plot the groups separately. For example,

plot3d(Datos$V1,
   Datos$V2,
   Datos$V3,
   type="n",   # Plot nothing, but set up the axes
   xlab="v1",ylab="v2",zlab="v3")
for (g in unique(Datos$V1)) 
   with(subset(Datos, V1 == g), 
     lines3d(V1, V2, V3, col = g))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM