how to show a dataset in 3d?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to show a dataset in 3d?

maggy yan
my dataset looks like this in the beginning:

  Subject  Time1  Time2  Time3
1         1  0.385  0.103 -0.488
2         2 -1.939  0.569  1.370
3         3 -1.196 -0.051  1.247
4         4  0.174 -1.163  0.989
5         5  1.246  0.558 -1.804
6         6 -1.108 -0.057  1.165
7         7 -0.609 -0.344  0.953

so each subject has three observations. now I need to show the dataset in
3d with scatterplot3d and plot3d together, that's what I don't know how it
works.

I tried:
scatterplot3d(data, type="p", highlight.3d=T, pch=16)

the graph looks like 3D but is not reall 3D, I mean I can't e.g. rotate it.
but how can combine both functions?

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: how to show a dataset in 3d?

Chris Campbell
# Hi Maggy
# Try the rgl package

con <- textConnection("  
  Subject  Time1  Time2  Time3  
         1  0.385  0.103 -0.488  
         2 -1.939  0.569  1.370  
         3 -1.196 -0.051  1.247  
         4  0.174 -1.163  0.989  
         5  1.246  0.558 -1.804  
         6 -1.108 -0.057  1.165  
         7 -0.609 -0.344  0.953  
")  
 
dat1 <- read.table(con, header = TRUE)  
 
require(rgl)  
cols <- rainbow(n = length(dat1$Subject))  
plot3d(dat1[, 2:4], col = cols)  
 

Chris Campbell
Tel. +44 (0) 1249 705 450 | Mobile. +44 (0) 7929 628349
mailto:[hidden email] | http://www.mango-solutions.com
Mango Solutions
2 Methuen Park, Chippenham, Wiltshire , SN14 OGB UK

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of maggy yan
Sent: 15 May 2013 15:34
To: [hidden email]
Subject: [R] how to show a dataset in 3d?

my dataset looks like this in the beginning:

  Subject  Time1  Time2  Time3
1         1  0.385  0.103 -0.488
2         2 -1.939  0.569  1.370
3         3 -1.196 -0.051  1.247
4         4  0.174 -1.163  0.989
5         5  1.246  0.558 -1.804
6         6 -1.108 -0.057  1.165
7         7 -0.609 -0.344  0.953

so each subject has three observations. now I need to show the dataset in 3d with scatterplot3d and plot3d together, that's what I don't know how it works.

I tried:
scatterplot3d(data, type="p", highlight.3d=T, pch=16)

the graph looks like 3D but is not reall 3D, I mean I can't e.g. rotate it.
but how can combine both functions?

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.

--

LEGAL NOTICE\ \ This message is intended for the use of ...{{dropped:18}}

______________________________________________
[hidden email] 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.