[R] colored 3d scatter plot

Jim Lemon jim at bitwrit.com.au
Wed Mar 5 03:54:35 CET 2008


SNN wrote:
> 
> I tried 
> 
> scatterplot3d(data, color = rep(c("red", "blue"), c(100, 15)), pch=16) and I
> am getting the following error message,
> 
> 
> Error in plot.xy(xy.coords(x, y), type = type, ...) : 
>         invalid color name
> 
> Does anyone know what he problem is?
Hi Nancy,
When you "rep" your colors, the second argument should be a number equal 
to the number of values. That is, if "data" contains 100 x, y and z 
components, try:

scatterplot3d(data,color=rep(c("red","blue"),50),pch=16)

My guess is that you are generating NAs or something with your version.

Jim



More information about the R-help mailing list