[旋轉角度]
a <- cbind(c(1,0,-1,0,0.5),c(0,1,0,-1,0.5))
b <- a
degree <- 60
b[,1] <- a[,1]*cos(2*pi/360*degree) - a[,2]*sin(2*pi/360*degree)
b[,2] <- a[,1]*sin(2*pi/360*degree) + a[,2]*cos(2*pi/360*degree)
COLOR <- c("red","orange","blue","purple","black")
par(mfrow=c(1,2))
plot(a,xlim=c(-2,2),ylim=c(-2,2),lty=1,col=COLOR,pch=19)
plot(b,xlim=c(-2,2),ylim=c(-2,2),lty=1,col=COLOR,pch=19)
#############################################
[鏡像]
b <- a ; b[,1] <- -a[,1] # 左右
b <- a ; b[,2] <- -a[,2] # 上下
#############################################
[重心計算]
group <- c(1,1,2,2,2)
Cen1 <- colMeans(a[group==1,])
Cen2 <- colMeans(a[group==2,])
#############################################
[夾角計算]
#############################################
[電子雲]
plot(B1[,1],B1[,2],xlim=XLIMB1,ylim=YLIMB1,pch=19,
main="多維標度法 (PCoA)",col=gsub("..$","03",Color),
xaxt='n',yaxt='n',xlab="",ylab="",cex=30,cex.main=2)
points(B1[,1],B1[,2],pch=19,col=gsub("..$","05",Color),cex=20)
points(B1[,1],B1[,2],pch=19,col=gsub("..$","07",Color),cex=10)
points(B1[,1],B1[,2],pch=19,col=gsub("..$","08",Color),cex=5)