• 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

  • 相关阅读:
    用js写留言信息的判断非空条件
    tp3.2中怎么访问分类及子分类下面的文章
    关于PHP中的 serialize () 和 unserialize () 的使用(即关于PHP中的值与已存储的表示的相互转换)
    iOS 8 Auto Layout界面自动布局系列2-使用Xcode的Interface Builder添加布局约束
    iOS深入学习(Block全面分析)
    面试4
    Android
    android适配不同分辨率的手机
    android分辨率适配
    Android屏幕适配全攻略(最权威的官方适配指导)
  • 原文地址:https://www.cnblogs.com/xudongliang/p/6927573.html
Copyright © 2020-2023  润新知