a

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

`[mediatagger]`

Skip to content
# #3 R animated cube

wpDiscuz
a

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

`[mediatagger]`

Does anyone have the codes for the non-animated 3D plot for nMDS with loading vectors and the vector labels?

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

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 )

Thank you very much for this example Israel, I will add it to the post content very soon

Ok Buddy. But Thank you for the page, I have learned a lot from this site.

How to put the graph inside markdown?