打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
R语言:一个画面上画多个图形的方法

备注:学习备忘

1、使用par(mfrow=c(2,2))即可

  1. >par(mfrow=c(3,3))  
  2. > plot(Nile)  
  3. > plot(Nile)  
  4. > plot(Nile)  
  5. > plot(Nile)  
  6. > plot(Nile)  
  7. > plot(Nile)  
  8. > plot(Nile)  
  9. > plot(Nile)  
  10. > plot(Nile)  


将平面分成3*3的形式。

2、使用split.screen()

  1. split.screen(c(2,1))        # split display into two screens  
  2. split.screen(c(1,3), screen = 2) # now split the bottom half into 3  
  3. screen(1) # prepare screen 1 for output  
  4. plot(10:1)  
  5. screen(4) # prepare screen 4 for output  
  6. plot(10:1)  
  7. close.screen(all = TRUE)    # exit split-screen mode  
  8.   
  9.   
  10. split.screen(c(2,1))        # split display into two screens  
  11. split.screen(c(1,2),2)      # split bottom half in two  
  12. plot(1:10)                  # screen 3 is active, draw plot  
  13. erase.screen()              # forgot label, erase and redraw  



得出:

split.screen()是用来划分屏幕的函数

  1. split.screen(c(2,1))    
是将图形分成两行一列的形式,给图形的索引从左到右,从上到下依次为1,2,3的格式

screen()函数用来选择屏幕


3、用layout()函数

  1. nf<-layout(matrix(c(1,2,3,4),2,2))  
  2. layout.show(nf)  



  1. nf<-layout(matrix(c(1,2,3,4,5,5),2,3))  
  2.  layout.show(nf)  

c(1,2,3,4,5,5)表示图形1,2,3,4,5要画的位置





在一图上在继续作图的函数:

lines()语句,你可以为一幅现有图形添加新的图形元
素。




本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
就靠layout函数,一张图可展示多个图表!
你的maptree还好吗?
如何用Origin绘制分边小提琴图
R语言基础教程5:图形页面排版
R 作图之图形布局
R语言绘图基础
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服