zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    自娱自乐
    项目冲刺(2)-第二、第三天
    项目冲刺(2)-第一天
    Beta版本冲刺计划及安排
    第一章 构造过程抽象
    python 学习2
    python 学习1
    ionic 初入门
    NodeJS学习
    软件工程实践总结作业——个人作业
  • 原文地址:https://www.cnblogs.com/xudongliang/p/6927573.html
Copyright © 2011-2022 走看看