[R] help with scatterplot3d

Ryan Briscoe Runquist rdbriscoe at ucdavis.edu
Mon Aug 13 21:03:36 CEST 2007


I am having a bit of trouble with scatterplot3d().

I was able to plot a 3d cloud of points using the following code:

>my.3dplot<-scatterplot3d(my.coords, pch=19, zlim=c(0,1), scale.y=0.5,
angle=30, box=FALSE)

where my.coords is a data frame that contains x, y, and z coordinates for
grid points whose elevation we sampled.

The problem occurs when I try to add points using points3d.  I tried to
follow the code in the examples of the package pdf.

First, I tried the following code to add all of the points that I wanted:

>my.3dplot$points3d(seq(400,600,0.19), seq(600,400,0.295),
seq(800,500,0.24), seq(1000,1400,0.22), seq(1200,600,0.24),
seq(1200,1500,0.28), seq(1300,1400,0.205), seq(1700,500,0.26),
seq(1700,600,0.21), seq(1900,1400,0.255), seq(2300,1400,0.275),
seq(2600,1300,0.225), seq(2700,400,0.235), seq(2700,1300,0.265),
seq(3100,1000,0.135), col="blue", type="h", pch=16)

and got the following error:
Error in seq.default(600, 400, 0.295) : wrong sign in 'by' argument

So I just tried to add the first point using the following code:

>my.3dplot$points3d(seq(400,600,0.19), col="blue", type="h", pch=16)

and got the following error message:

Error in xyz.coords(x, y, z) : 'x', 'y' and 'z' lengths differ.

Does anyone know how I can use this function in the scatterplot3d package?

Thanks so much!


Ryan D. Briscoe Runquist
Population Biology Graduate Group
University of California, Davis
rdbriscoe at ucdavis.edu

More information about the R-help mailing list