[R] 3dscatterplot -different colors for different factors of the same variable

From: Moreno Ignazio Coco <M.I.Coco_at_sms.ed.ac.uk>
Date: Tue, 13 May 2008 17:49:38 +0100

Dear R users,

I was trying to do a 3d scatterplot for the following set of datas:

         "obj"  "time" "X" "Y"

"1" "yellow" "333" "388.7" "492.3"
"2" "yellow" "567" "388.7" "492.3"
"3" "green" "621" "135.5" "371.7"
"4" "green" "1039" "135.5" "371.7"
"5" "red" "1373" "744.1" "205.0"
"6" "red" "1763" "744.1" "205.0"
The points should be drew in the plot taking information of "time",

"X" and "Y". The colors of these points should be assigned according
to the information contained in variable "obj". What I did but it didn't work out is:
  1. Plotting only one set of points (the green one)

s3d<-scatterplot3d(greenpts[,3],greenpts[,2],greenpts[,4],type="p",scale.y=4, angle=10, color="green")

and try to overlay the others (as you normally would do with "plot"):

s3d$points3d(yellowpts[,3],yellowpts[,2],yellowpts[,4], col="yellow",type="o")

R has plotted only the first set and wasn't able to overlay other points.

2) I have generated a "for" loop that should have taken points information ,arranged into a list object, plotting them one by one. - listpoints = list(X,Y,time)
-color<-rep("black",26) ##solution found in one of the discussion around scatterplot


for (i in 1:26)
points3d(listpoints[i],type=1, col=color[i])

Also this way didn't work out. Do you have any solution? Many thanks


P.S. I have tried also points3d(rgl) trying to follow an explanation given in the forum but i haven't understood how to set the function.

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 13 May 2008 - 18:35:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 13 May 2008 - 21:31:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive