Dale,

I do not have the same color problem when I run your code on my PC.  The 
colors in both devices look the same.  I'm running R version 2.13.0 on 
Windows.

I am not familiar with the rgl package, but I found a function that might 
be helpful to you when I searched for "gif" in the package reference 
manual.

?movie3d()

Hope this helps.

Jean


`·.,,  ><(((º>   `·.,,  ><(((º>   `·.,,  ><(((º>

Jean V. Adams
Statistician
U.S. Geological Survey
Great Lakes Science Center
223 East Steinfest Road
Antigo, WI 54409  USA



From:
Dale Coons <dale.co...@gmail.com>
To:
r-help@r-project.org
Date:
07/28/2011 03:22 PM
Subject:
[R] Animated gif or something similar in R?
Sent by:
r-help-boun...@r-project.org



I'm have a (minor) problem and a question.
Problem: The following code creates 5 clusters of dots of different 
colors.  However, I need the second call outside the data.frame call to 
get the colors to change for some reason.  I assume there's an error in 
the data.frame() call, but I don't know what.
Question: Is there is a way to cause the resulting graphic to rotate on 
it's own and to output to a animated gif or some other format that could 
be used in a powerpoint type presentation?  I work with a bunch of 
'drama queens'--they'd like it if there was some motion rather than a 
static display ;-)

Thanks in advance,
Dale.

library(rgl)
clusset<-data.frame(x=c(round(abs(rnorm(5,7,1)),1),round(abs(rnorm(5,11,2)),1),
 
round(abs(rnorm(5,16,2)),1),round(abs(rnorm(5,20,1.5)),1),round(abs(rnorm(5,5,2)),1)),
 
y=c(round(abs(rnorm(5,7,2)),1),round(abs(rnorm(5,11,2)),1),
 
round(abs(rnorm(5,16,2)),1),round(abs(rnorm(5,4,2)),1),round(abs(rnorm(5,7,2)),1)),
 
z=c(round(abs(rnorm(5,7,2)),1),round(abs(rnorm(5,12,2)),1),
 
round(abs(rnorm(5,16,1)),1),round(abs(rnorm(5,6,2)),1),round(abs(rnorm(5,17,2)),1)),
 
dotcol=c(rep('red2',5),rep('green2',5),rep('blue2',5),rep('yellow1',5),rep('purple2',5))
                     )

#this call doesn't show the right colors--why?
plot3d(clusset, xlim=c(0,25), ylim=c(0,25), 
zlim=c(0,25),xlab='',ylab='',zlab='',  col=clusset$dotcol, radius=1, 
type='s')
#but if I redefine the colors again and call, it does
clusset$dotcol<-c(rep('red2',5),rep('green2',5),rep('blue2',5),rep('yellow1',5),rep('purple2',5))
plot3d(clusset, xlim=c(0,25), ylim=c(0,25), 
zlim=c(0,25),xlab='',ylab='',zlab='', col=clusset$dotcol, radius=1, 
type='s')

______________________________________________
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.



        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to