library(gganimate)
library(gifski) # 构造数据
phi<-pi/6
theta<-pi/3
c<-matrix(c(cos(phi),sin(phi),-sin(phi),cos(phi)),
nrow=2,byrow=TRUE)
b<-matrix(c(5,0,0,1),nrow=2,byrow=TRUE)
a<-matrix(c(cos(theta),-sin(theta),sin(theta),cos(theta)),
nrow=2,byrow=TRUE)
A<-a%*%b%*%c
A x<-matrix(c(1,0,0,1),nrow=2,byrow=TRUE)
rotate1<-c%*%x
stretch<-b%*%c%*%x
rotate2<-a%*%b%*%c%*%x
svd_trans<-cbind(x,rotate1,stretch,rotate2)
df1<-data.frame(t=c(1,1,2,2,3,3,4,4),
x1=c(0,0,0,0,0,0,0,0),
y1=c(0,0,0,0,0,0,0,0),
x2=svd_trans[1,],
y2=svd_trans[2,],
point=c('A','B','A','B','A','B','A','B')) Points<-matrix(c(cos(seq(0,2*pi,0.01*pi)),
sin(seq(0,2*pi,0.01*pi))),
byrow=TRUE,nrow=2)
Points_rotate1<-c%*%Points
Points_stretch<-b%*%c%*%Points
Points_rotate2<-a%*%b%*%c%*%Points
Points_svd<-cbind(Points,Points_rotate1,Points_stretch,Points_rotate2)
df2<-data.frame(Points_x=Points_svd[1,],
Points_y=Points_svd[2,],
t=rep(c(1,2,3,4),each=ncol(Points))) # 绘制图形
p<-ggplot()+
geom_segment(data=df1,aes(x=x1,y=y1,xend=x2,yend=y2,color=point),
arrow=arrow(length = unit(0.03, "npc")))+
geom_point(data=df2,aes(x=Points_x,y=Points_y),size=0.01)+
labs(x=expression(x),y=expression(y))+
theme(legend.position="none")+
transition_states(t)
animate(p, renderer = gifski_renderer())

最新文章

  1. [No00008F]PLSQL自动登录,记住用户名密码&amp;日常使用技巧
  2. 【Python】supervisor安装和管理celery
  3. Linux下如何删除Oracle
  4. 根据某个文件或文件夹自制rpm包
  5. Class.asSubclass浅谈
  6. SimpleDateFormat格式化日期
  7. eMarketer:DMP帮广告主搞定大数据处理问题
  8. 轻仿QQ音乐之音频歌词播放、锁屏歌词-b
  9. c# 另存为excel
  10. HDU ACM 1290 献给杭电五十周年校庆的礼物
  11. Monthly update for Dynamics 365 for Operation
  12. springmvc与freemarker的整合
  13. 剑指offer面试题4 替换空格(java)
  14. 【Solution】MySQL 5.8 this is incompatible with sql_mode=only_full_group_by
  15. 在 Azure 上部署 Kubernetes 集群
  16. 使用IWMS的网站打开显示“未能加载文件或程序集”,解决方案
  17. 一键安装基于dns的高可用k8s集群(3节点,etcd https)
  18. 阿里云服务器配置免费https服务
  19. 17.docker及scrapy-splash安装-1
  20. multimap多重映照容器(常用的方法总结)

热门文章

  1. Vue-cli创建的项目结构分析,各初始化文件解释说明
  2. js中各种函数
  3. 第七周作业-N67044-张铭扬
  4. ElementUI导航连续点击报错
  5. 04-python垃圾回收机制
  6. 使用open打开子页面时,父页面关闭子页面操作
  7. unity 实现Game窗口的Stats 【转自蛮牛】
  8. redis底层数据结构之整数集合(intset)
  9. dart 学习笔记
  10. 070_GET https://login.salesforce.com/17181/logo180.png 404 (Not Found)