Kari-4 wrote: > > > I've created a 3d scatterplot, and had no problems labeling the points. > However, I've been really struggling to change the color of the points > based > on a factor (see 'group' below). Is such a thing possible? > >
Its always polite to make the example self-running by adding the library and the input. But your's was close. Dieter library(rgl) ttt = textConnection(" food group x y z apple fruit 0.216 -0.112 -0.893 orange fruit 0.814 0.097 0.460 broccoli veg -0.239 0.240 -0.425 banana fruit 0.222 0.968 -0.050 parsnip veg 0.139 0.897 0.378 garlic veg -0.104 0.510 -0.400 ") colors =c("green","blue","red") pca <- read.table(ttt,header=TRUE) p3d<- plot3d(pca$x, pca$y, pca$z, xlab="Component 1", ylab="Component 2", zlab="Component 3", col=as.integer(pca$group) , box=FALSE, size=5) food.v<-as.vector(pca$food) text3d(pca$x, pca$y, pca$z, food.v, cex=0.9, adj = 1) -- View this message in context: http://r.789695.n4.nabble.com/plot3d-color-points-by-group-tp3312955p3313268.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.