zoukankan      html  css  js  c++  java
  • par函数mgp 参数-控制坐标轴的位置

    mgp 参数的值为长度为3的一个向量,默认值为 c(3, 1, 0); 3个数值控制的元素不同

    1) 第一个数值:3, 控制xlab 和  ylab的位置

    示例用法:

    par(mfrow = c(1, 3), oma = c(1, 1, 1, 1))

    plot(1:10, main = "main", sub = "sub", mgp = c(1, 1, 0))
    box(which = "figure")
    plot(1:10,main = "main", sub = "sub", mgp = c(2, 1, 0))
    box(which = "figure")
    plot(1:10, main = "main", sub = "sub",mgp = c(3, 1, 0))
    box(which = "figure")

    效果图如下:

    注意观察,xlab 和 ylab的位置,从左到右我分别设置了1到3; 从图中也可以看出来,影响的元素的包括xlab, ylab, sub

    2) 第二个数值 1, 影响的是坐标轴的轴线的位置

     示例用法:

    par(mfrow = c(1, 3), oma = c(1, 1, 1, 1))
    
    plot(1:10, main = "main", sub = "sub", mgp = c(3,1, 0))
    box(which = "figure")
    plot(1:10,main = "main", sub = "sub", mgp = c(3, 2, 0))
    box(which = "figure")
    plot(1:10, main = "main", sub = "sub",mgp = c(3, 3, 0))
    box(which = "figure")

    效果图如下:

    可以看出,受影响的元素为 坐标轴对应的标签的位置;

    3) 第三个数值 0:

    示例用法:

    par(mfrow = c(1, 3), oma = c(1, 1, 1, 1))
    
    plot(1:10, main = "main", sub = "sub", mgp = c(3,1, 0))
    box(which = "figure")
    plot(1:10,main = "main", sub = "sub", mgp = c(3, 1, 1))
    box(which = "figure")
    plot(1:10, main = "main", sub = "sub",mgp = c(3, 1, 2))
    box(which = "figure")

    效果图如下:

    可以看到,影响的元素为坐标轴轴线的位置;

  • 相关阅读:
    叩开抽象的大门(2)——依赖于抽象
    威老迷宫探险第二季如何更面向对象
    更佳的封装之路面向对象的封装思想
    威老的迷宫探险
    重用,我要重用!!!
    威老出国记,什么是引用,别名。
    叩开抽象的大门(1)——抽象类、接口
    maven常用命令
    大公司喜欢问的问题
    java 发送http请求
  • 原文地址:https://www.cnblogs.com/xudongliang/p/7993109.html
Copyright © 2011-2022 走看看