作者gsuper (Logit(odds))
看板R_Language
标题[分享] xy xcatter plot, 座标旋转
时间Mon Jun 1 16:42:48 2015
#############################################
#############################################
### 图片角度调整
[旋转角度]
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,])
#############################################
[夹角计算]
#############################################
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 140.113.250.41
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/R_Language/M.1433148171.A.373.html
1F:推 celestialgod: 推荐你可以用rgl画,可以自由旋转.... 06/01 17:10
※ 编辑: gsuper (140.113.250.41), 06/01/2015 17:44:29
2F:→ celestialgod: 我误会你的图了... 06/01 17:49
※ 编辑: gsuper (140.113.250.41), 06/01/2015 17:55:46
3F:→ celestialgod: 你可以改成用Givens rotation 06/01 17:53
4F:→ celestialgod: rot_mat = function(degree) cos(degree*2*pi/360)+ 06/01 17:53
5F:→ celestialgod: c(0,sin(degree*2*pi/36)*c(-1,1),0) 06/01 17:54
6F:→ celestialgod: b = a %*% rot_mat(degree) 06/01 17:54
7F:→ gsuper: 行列式有点苦手 06/01 17:57
※ 编辑: gsuper (114.32.201.238), 06/08/2015 09:44:07
※ 编辑: gsuper (114.32.201.238), 06/08/2015 10:52:06
8F:→ celestialgod: 不太懂你的电子云要做什麽?很多变数都没有 06/08 11:00
9F:→ celestialgod: 跑不出来Q____Q 06/08 11:00
姑且是像笔记一样的东西
可能最後变成 2D scatter plot 的操作 之类的文章吧
慢慢更新不着急
※ 编辑: gsuper (114.32.201.238), 06/08/2015 11:42:17
※ 编辑: gsuper (114.32.201.238), 07/02/2015 09:39:25
※ 编辑: gsuper (114.32.201.238), 07/02/2015 09:44:03