Ana Kolar
2009-Sep-21 14:38 UTC
[R] Three dimensional view of the profiles using 'rgl' package (example of 3 dimensional graphics using rgl package).
Hi there, Anyone has an idea how to put those two sets of code together so that I can get a 3-dimensional picture that includes points instead of 2 separate pictures which doesnt make that much sense at the end. #Let's say that these are the data we would like to plot: A<-c(62,84,53) B<-c(64,82,55) C<-c(56,74,41) D<-c(46,68,38) E<-c(71,98,72) data<-rbind(A,B,C,D,E) colnames(data)<-c("One", "Two","Three") library(rgl) # First set of code which gives 3-D picture rgl.lines(c(0,1.2),c(0,0),c(0,0)) rgl.lines(c(0,0),c(0,1.2),c(0,0)) rgl.lines(c(0,0),c(0,0),c(0,1.2)) rgl.lines(c(0,0),c(0,1),c(1,0),size=2) rgl.lines(c(0,1),c(1,0),c(0,0),size=2) rgl.lines(c(0,1),c(0,0),c(1,0),size=2) # Second set of code which gives only points that should actually be on the previous picture rgl.points(data[,3],data[,1],data[,2], size=5) rgl.texts(data[,3],data[,1],data[,2], text=rownames(data)) Looking forward to hear from you. Regards, Ana [[alternative HTML version deleted]]
Schalk Heunis
2009-Sep-21 14:49 UTC
[R] Three dimensional view of the profiles using 'rgl' package (example of 3 dimensional graphics using rgl package).
Ana Not sure if I understood your problem, but on my side, the lines and points are both on the same 3-d picture. However, the lines are just very small: by setting data = data/100, the lines and points are both visible. HTH Schalk Heunis On Mon, Sep 21, 2009 at 4:38 PM, Ana Kolar <annakolar at yahoo.com> wrote:> Hi there, > > Anyone has an idea how to put those two sets of code together so that I can get a 3-dimensional picture that includes points instead of 2 separate pictures which doesnt make that much sense at the end. > > #Let's say that these are the data we would like to plot: > > A<-c(62,84,53) > B<-c(64,82,55) > C<-c(56,74,41) > D<-c(46,68,38) > E<-c(71,98,72) > data<-rbind(A,B,C,D,E) > colnames(data)<-c("One", "Two","Three") > > library(rgl) > > # First set of code which gives 3-D picture > rgl.lines(c(0,1.2),c(0,0),c(0,0)) > rgl.lines(c(0,0),c(0,1.2),c(0,0)) > rgl.lines(c(0,0),c(0,0),c(0,1.2)) > rgl.lines(c(0,0),c(0,1),c(1,0),size=2) > rgl.lines(c(0,1),c(1,0),c(0,0),size=2) > rgl.lines(c(0,1),c(0,0),c(1,0),size=2) > > # Second set of code which gives only points that should actually be on the previous picture > rgl.points(data[,3],data[,1],data[,2], > size=5) > rgl.texts(data[,3],data[,1],data[,2], > text=rownames(data)) > > Looking forward to hear from you. > > Regards, > > Ana > > > > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >