R语言:多个图形绘制在一个画板的方法

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

par(mfrow=c(3,3))
plot(Nile)
plot(Nile)
plot(Nile)
plot(Nile)
plot(Nile)
plot(Nile)
plot(Nile)
plot(Nile)
plot(Nile)

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

2、使用split.screen()

split.screen(c(2,1)) # split display into two screens
split.screen(c(1,3), screen = 2) # now split the bottom half into 3
screen(1) # prepare screen 1 for output
plot(10:1)
screen(4) # prepare screen 4 for output
plot(10:1)
close.screen(all = TRUE) # exit split-screen mode

split.screen(c(2,1)) # split display into two screens
split.screen(c(1,2),2) # split bottom half in two
plot(1:10) # screen 3 is active, draw plot
erase.screen() # forgot label, erase and redraw

得出:

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

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

3、用layout()函数

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

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

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

在一图上在继续作图的函数:
lines()语句,你可以为一幅现有图形添加新的图形元
素。

  • 0
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值