0

I am using the plot3d function from the rgl package. I have generated spheres using xyz co-ordinate data and I want to connect them with single line.

Here is my code:

file=read.table("input.txt")
df=data.frame(x=file[,1],y=file[,2],z=file[,3], color=file[,4])
plot3d(df$x, df$y, df$z, col=df$col,  type='b')

where b is for points joined by lines

If I use s instead of b it is giving me only spheres.

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453

1 Answers1

2

If you look at the documentation in ?rgl, type="b" isn't supported.

type: For the default method, a single character indicating the type of item to plot. Supported types are: 'p' for points, 's' for spheres, 'l' for lines, 'h' for line segments from ‘z=0’, and 'n' for nothing. For the ‘mesh3d’ method, one of 'shade', 'wire', or 'dots'. Partial matching is used.

I would try plot3d() followed by lines3d().

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453