R语言plot参数_plot函数参数

R语言plot参数_plot函数参数最近用R语言画图,plot函数是用的最多的函数,而他的参数非常繁多,由此总结一下,以供后续方便查阅。plot(x,y=NULL,type="p",xlim=NULL,ylim=NULL,log="",main=NULL,sub=NULL,xlab=NULL,ylab=NULL,ann=par("ann"),axes=TRUE,fra…


Jetbrains全系列IDE稳定放心使用

最近用R语言画图,plot 函数是用的最多的函数,而他的参数非常繁多,由此总结一下,以供后续方便查阅。

plot(x, y = NULL, type = “p”, xlim = NULL, ylim = NULL,
log = “”, main = NULL, sub = NULL, xlab = NULL, ylab = NULL,
ann = par(“ann”), axes = TRUE, frame.plot = axes,
panel.first = NULL, panel.last = NULL, asp = NA, …)

plot 支持R 模块有:functions,data.frames,density,factor,table等常用结构。

plot参数:

(1)type类型

 R语言plot参数_plot函数参数

 

 

 

(2)xlim, x 用 (x1, x2) 限制 plot 的x 轴。同理,ylim,y 用(y1,y2)限制plot的y轴。

(3)main,给图片加标题.main=”这是一幅图的标题”.

或者 

title(“Main Title”, sub = “sub title”,
cex.main = 2, font.main= 4, col.main= “blue”,
cex.sub = 0.75, font.sub = 3, col.sub = “red”)

(4) xlab =“这是X轴表示什么”,ylab =“这是Y轴表示什么”

(5)axes指示是否两个坐标轴都画出。

(6) asp 限定 y/x aspect 比率

(7) points and lines

参数描述

pch 指定绘制点时使用的符号

 R语言plot参数_plot函数参数

 

cex 指定符号的大小。cex是一个数值,表示绘图符号相对于默认大小的缩放倍数。默认大小为1,1.5表示放大为默认值的1.5倍,0.5表示缩小为默认值的50%,等等

lty 指定线条类型

 R语言plot参数_plot函数参数

 

lwd 指定线条宽度。lwd是以默认值的相对大小来表示的(默认值为1)。例如,lwd=2将生成一条两倍于默认宽度的线条

 (2)颜色

用于指定颜色的参数

col 默认的绘图颜色。某些函数(如lines和pie)可以接受一个含有颜色值的向量并自动循环使用。例如,如果设定col=c(“red”, “blue”)并需要绘制三条线,则第一条线将为红色,第二条线为蓝色,第三条线又将为红色

col.axis 坐标轴刻度文字的颜色

col.lab 坐标轴标签(名称)的颜色

col.main 标题颜色

col.sub 副标题颜色

fg 图形的前景色

bg 图形的背景色

(3)字体

用于指定文本大小的参数

cex 表示相对于默认大小缩放倍数的数值。默认大小为1,1.5表示放大为默认值的1.5倍,0.5表示缩小为默认值的50%,等等

cex.axis 坐标轴刻度文字的缩放倍数。类似于cex

cex.lab 坐标轴标签(名称)的缩放倍数。类似于cex

cex.main 标题的缩放倍数。类似于cex

cex.sub 副标题的缩放倍数。类似于cex

用于指定字体族、字号和字样的参数

font 整数。用于指定绘图使用的字体样式。1=常规,2=粗体,3=斜体,4=粗斜体,5=符号字体(以Adobe符号编码表示)

font.axis 坐标轴刻度文字的字体样式

font.lab 坐标轴标签(名称)的字体样式

font.main 标题的字体样式

font.sub 副标题的字体样式

ps 字体磅值(1磅约为1/72英寸)。文本的最终大小为 ps*cex

family 绘制文本时使用的字体族。标准的取值为serif(衬线)、sans(无衬线)和mono(等宽)

(4)图形尺寸和边界尺寸

用于控制图形尺寸和边界大小的参数

pin 以英寸表示的图形尺寸(宽和高)

mai 以数值向量表示的边界大小,顺序为“下、左、上、右”,单位为英寸

mar 以数值向量表示的边界大小,顺序为“下、左、上、右”,单位为英分*。默认值为c(5, 4, 4, 2) + 0.1

 

 R语言plot参数_plot函数参数

 

(8) Title,text,mtext

title(main = NULL, sub = NULL, xlab = NULL, ylab = NULL,

      line = NA, outer = FALSE, …) 主要指定标题字体,大小,颜色,以及X和Y坐标轴的字体,大小,颜色。

main

The main title (on top) using font, size (character expansion) and color par(c(“font.main”, “cex.main”, “col.main”)).

sub

Sub-title (at bottom) using font, size and color par(c(“font.sub”, “cex.sub”, “col.sub”)).

xlab

X axis label using font, size and color par(c(“font.lab”, “cex.lab”, “col.lab”)).

ylab

Y axis label, same font attributes as xlab.

line

specifying a value for line overrides the default placement of labels, and places them this many lines outwards from the plot edge.

outer

a logical value. If TRUE, the titles are placed in the outer margins of the plot.

例如:title(main = list("Stopping Distance versus Speed", cex = 1.5,
                  col = "red", font = 3))

 

 

text(x, y = NULL, labels = seq_along(x$x), adj = NULL,
     pos = NULL, offset = 0.5, vfont = NULL,
     cex = 1, col = NULL, font = NULL, ...)

在给定X和Y的基础上插入一段注释,

Pos:a position specifier for the text. If specified this overrides any adj value given. Values of 1, 2, 3 and 4, respectively indicate positions below, to the left of, above and to the right of the specified coordinates.,1表示下方,2表示左方,3表示上方,4表示右方。

Labels: a character vector or expression specifying the text to be written. An attempt is made to coerce other language objects (names and calls) to expressions, and vectors and other classed objects to character vectors by as.character. If labels is longer than x and y, the coordinates are recycled to the length of labels.注释部分。

mtext(text, side = 3, line = 0, outer = FALSE, at = NA,
      adj = NA, padj = NA, cex = NA, col = NA, font = NA, ...)

Text is written in one of the four margins of the current figure region or one of the outer margins of the device region。在作图的外围。

side

on which side of the plot (1=bottom, 2=left, 3=top, 4=right).

line

on which MARgin line, starting at 0 counting outwards.

Las:numeric in {0,1,2,3}; the style of axis labels. 标识坐标轴标签方向。

0:always parallel to the axis [default],

1:always horizontal,

2:always perpendicular to the axis,

3:always vertical.

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/181575.html原文链接:https://javaforall.net

赞 (0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • robots.txt文件详解「建议收藏」

    robots.txt文件详解「建议收藏」原文地址:robots.txt-禁止爬虫Robots.txt-禁止爬虫robots.txt用于禁止网络爬虫访问网站指定目录。robots.txt的格式采用面向行的语法:空行、注释行(以#打头)、规则行。规则行的格式为:Field:value。常见的规则行:User-Agent、Disallow、Allow行。User-Agent行User-Agent:r

    2022年5月6日
  • 个人嵌入式学习总结

    个人嵌入式学习总结个人认为,嵌入式学习主要经过以下几个阶段,1. 嵌入式linux的移植;主要包括u-boot源码的修改,kernel针对特定硬件平台的修改,系统硬体驱动的移植,根文件系统的制作;2. 系统电路设计;包括根据系统功能选择硬件资源,接口电路的设计;PCB电路图的设计与布线优化。3. linux驱

    2022年5月15日
  • linux 防火墙打开5432 端口,在Ubuntu上打开端口5432

    linux 防火墙打开5432 端口,在Ubuntu上打开端口5432问题描述我正在尝试使用sudoufwallow5432/tcp的ufw在ubuntu上打开端口5432然后,我使用nmap查看端口5432是否已打开,并且得到以下信息:root@domain:~#sudonmap-sS-O127.0.0.1StartingNmap5.21(http://nmap.org)at2011-12-0114:28MSKNmapscan…

    2022年6月19日
  • 银河麒麟安装windows虚拟机_中标麒麟安装vmtools

    银河麒麟安装windows虚拟机_中标麒麟安装vmtools下载系统:http://download.cs2c.com.cn/neokylin/desktop/releases/6.0/x86_64/iso/安装系统:1.新建虚拟机,选择典型,下一步2.稍后安装操作系统,下一步3.选择Linux系统版本为其他Linux3.x内核,下一步4.设置磁盘大小为…

    2022年8月10日
  • UML图之例图

    用例图主要说明的是谁要使用系统,以及他们使用该系统可以做些什么,帮助开发团队以一种可视化的方式理解系统的功能需求。一个用例图包含了多个模型元素,如系统、参与者和用例,并且显示这些元素之间的各种关系,

    2021年12月29日
  • gear s3刷android wear,【干货】三星Gear S3/Gear S3 classic 智能手表刷机教程「建议收藏」

    gear s3刷android wear,【干货】三星Gear S3/Gear S3 classic 智能手表刷机教程「建议收藏」今年九月在IFA电子展正式亮相的三星GearS3在本月即将在国内开卖,目前不少电商的商家已经为这款新品进行预热,从电商的价格来看这两款定位不同的智能手表(经典款/先锋款)的价格都为3599元,三星GearS3支持IP68级别防水,兼容Android4.4以及之后的安卓系统版本以及运存1.5GB以上的安卓智能手机。与苹果AppleWatch有诊断接口但是无法刷机不同,三星GearS系列手表支…

    2022年7月21日

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号