#3 A cube in 3D

a


Not what you are looking for ? Make a new search !

[mediatagger]


4
Leave a Reply

avatar
1 Comment threads
3 Thread replies
1 Followers
 
Most reacted comment
Hottest comment thread
3 Comment authors
IsraelHoltzSean Birchall Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Sean Birchall
Guest
Sean Birchall

Is there anywhere we can get the codes for these graphs?

Israel
Guest
Israel

library( rgl )
z=iris
#colors vector
x=rep(0,150)

for (i in 1:150) {
if(z$Species[i] == “setosa”) x[i]=”royalblue1″
if(z$Species[i] == “versicolor”) x[i]=”darkcyan”
if(z$Species[i] == “virginica”) x[i]=”oldlace”
}
z$Color=x

plot3d( z[,1], z[,2], z[,3], col = z$Color, type = “s”, radius = .02 )

#We can indicate the axis and the rotation velocity

play3d( spin3d( axis = c(0, 0, 1), rpm = 7), duration = 10 )

#Save like gift

movie3d( spin3d( axis = c(0, 0, 1), rpm = 7),
duration = 10, dir = getwd(),
type = “gif”, clean = TRUE )