[R] scatterplot3D

Duncan Murdoch murdoch.duncan at gmail.com
Tue Sep 27 02:11:38 CEST 2011


On 11-09-26 5:14 PM, XINLI LI wrote:
> Is there any way to plot a 3-D scatter plot for two groups on one graph?

If you are using rgl::plot3d, plot the second with add=TRUE.

As David said, use colours or something to distinguish.

For example,

library(rgl)

data1 <- matrix(rnorm(30), ncol=3)
plot3d(data1, col="red", type="s")

data2 <- matrix(rnorm(30)+2, ncol=3)
plot3d(data2, col="blue", type="s", add=TRUE)

Duncan Murdoch



More information about the R-help mailing list