R绘图系统边框详解
2024-10-13 04:09:54
在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
最新文章
- dedecms功能性函数封装(XSS过滤、编码、浏览器XSS hack、字符操作函数)
- FreeBSD_11-系统管理——{Part_3-网络}
- jquery选中将select下拉框中一项后赋值给text文本框
- [开发笔记]-WindowsService服务程序开发
- 分享一道我认为非常有思考价值JavaScript题目
- C++学习笔记:List容器
- ubuntu usb权限问题解决
- Hibernate 一对多注解 mappedby 作用
- .net dynamic动态加属性
- js实现二叉树
- C语言strcpy,strncpy和strlcpy讲解
- scrapy学习笔记(1)
- ModelBiner不验证某个属性
- 第一个VS2015 Xaramin Android项目(终)
- Wannafly挑战赛25游记
- hustoj升级
- Zabbix监控系统
- Mysql计算并保留两位小数
- freemarker中的null异常处理以及!与??的使用(转)
- B-树(B+树) 学习总结