Well, this turned out frigging amazing don't you think? Much better than the previous 2D "snow globe & flashlight" view.
Here's the process in R-Studio
#Setup
instal.packages("rgl")
#For RGL
library(rgl)
#Read the data
v = t(as.matrix(read.table("res58.txt",sep=",")))
#Remove zero variance columns
v = v[,which(apply(v,2,var)!=0)]
#Generate PCA
v.pca <- prcomp(v,scale. = TRUE, center = TRUE)
data=as.data.frame(v.pca$x)
#Plot it
plot3d(data[,1:3], col=c(1:4), size=10, type='p')
text3d(data[,1]+1, data[,2]+1, data[,3]+1,texts=c(rownames(data)), cex= 0.7, pos=3)
#Rotate it
for (i in 1:360) {
rgl.viewpoint(theta=i, phi=30, fov=60, zoom = 0.4)
Sys.sleep(.05)}
#Save 360 PNG images
dir.create("an-gif")
for (i in 1:360) {
rgl.viewpoint(theta=i, phi=30, fov=60, zoom = 0.5)
rgl.snapshot(filename=paste("an-gif/frame-",
sprintf("%03d", i), ".png", sep=""))}
Then convert 360 PNGs to a motion GIF with You are not allowed to view links.
Register or
Login to view..
Pretty happy with these results. Very cool.