R绘图系统边框详解

在R语言的基础绘图系统中,有plot, figure, outer, inner 共4种边框;

这四种边框实际上明确了整个绘图设备的布局

1) outer,  当我们声明一个绘图设备的时候,outer 指的就是这个设备上,下,左,右4个边框

代码示例:

plot(1:5)
box(which = "outer", col = "red", lwd = 10)

生成的图片如下:

可以看到 outer 边框为整个绘图设备最外圈的边框

2) inner : outer 是整个绘图设备最外圈,inner 边框中就是实际用于绘图的区域,默认情况下整个绘图设备都用于绘制图表,所以inner 边框和 outer 边框是重合的,通过设置 outer margin 可以将 inner  和 outer  边框区分开

代码示例:

par(omi = c(1, 1, 1, 1))
plot(1:5)
box(which = "outer", col = "red",  lwd = 10)
box(which = "inner", col = "blue", lwd = 5)

生成的图片如下:

通过设置outer magin , 可以看到 inner  边框为蓝色, 红色的是 outer  边框

3)figure : inner 边框中为实际的绘图区域, 对于绘图区域,有时有可以分成多个子区域,每个区域用来绘制一幅图,figure 指的就是每一副图的边框

代码示例:

par(omi = c(1, 1, 1, 1), mfrow = c(1, 2))
plot(1:5)
box(which = "figure", col = "red", lwd = 2)
plot(1:5)
box(which = "figure", col = "blue", lwd = 2)

生成的图片如下:

这里将绘图区域分成了两个子区域,从图中可以看出,figure 是每个子图的边框

4) plot : 每幅图的坐标系所处的边框

代码示例:

par(omi = c(1, 1, 1, 1), mfrow = c(1, 2))
plot(1:5)
box(which = "plot",   col = "red", lwd = 2)
box(which = "figure", col = "red", lwd = 2)
plot(1:5)
box(which = "plot",   col = "blue", lwd = 2)
box(which = "figure", col = "blue", lwd = 2)

生成的图片如下:

从图中可以看出,plot 边框就是每个子图的坐标系所处的边框, 在 plot 边框和 figure 边框之间处所的空白区域就是 margin

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值