plot函数--R语言
1. 函数功能
Generic function for plotting of R objects.
For simple scatter plots, plot.default will be used.
However, there are plot methods for many R objects, including functions, data.frames, density objects, etc.
Use methods(plot) and the documentation for these.
用于绘制R对象的通用函数。
对于简单的散点图,将使用plot.default。
2.函数语法
plot(x, y, ...)
3. 函数参数
3.1 : X
x
the coordinates of points in the plot.
Alternatively, a single plotting structure, function or any R object
with a plot method can be provided.
图中点的坐标。
3.2: y
y
the y coordinates of points in the plot,
optional if x is an appropriate structure.
绘图中点的y坐标
x,y可以都给,当只给出x,则绘图时默认x为y,生成x关于下标的图形
a <- sample(1:100,10)
plot(a)
3.3 : …
Arguments to be passed to methods
Many methods will accept the following arguments:
要传递给方法的参数
许多方法将接受以下参数:
3.3.1 : type
type
what type of plot should be drawn. Possible types are:
绘制图形的类型,取值有:
"p" for points,"l" for lines,"b" for both,"c" for the lines part alone of "b","o" for both ‘overplotted’,"h" for ‘histogram’ like (or ‘high-density’) vertical lines,"s" for stair steps,"S" for other steps, see ‘Details’ below,"n" for no plotting.
默认绘制散点图
plot(sale$日期,sale$销量)
type=‘l’,绘制线图
plot(sale$日期,sale$销量,type='l')
type=‘b’,同时绘制散点和折线图
plot(sale$日期,sale$销量,type='b')
type=‘c’,只要type='b’的折线部分,散点去除
plot(sale$日期,sale$销量,type='c')
type=‘o’,同时绘制点和线,且线穿过点
plot(sale$日期,sale$销量,type='o')
type=‘h’,绘制出点到横坐标轴的垂直线;
plot(sale$日期,sale$销量,type='h')
type=‘s’, 绘制出阶梯图(先横后纵)
plot(sale$日期,sale$销量,type='s')
type=‘S’,绘制出阶梯图(先纵后横)
plot(sale$日期,sale$销量,type='S')
type=‘n’,没有散点,仅显示框架
plot(sale$日期,sale$销量,type='n')
3.3.2 :main
main
an overall title for the plot
图形标题
plot(sale$日期,sale$销量,type='b',main='每日用餐人数折线图')
3.3.3 :sub
sub
a sub title for the plot
图形的子标题
plot(sale$日期,sale$销量,type='b',main='每日用餐人数折线图',sub='图1')
3.3.4 :xlab
xlab
a title for the x axis
x轴标题
plot(sale$日期,sale$销量,type='b',main='每日用餐人数折线图',sub='图1',xlab='日期')
3.3.5 : ylab
ylab
a title for the y axis
y轴标题
plot(sale$日期,sale$销量,type='b',main='每日用餐人数折线图',sub='图1',xlab='日期',ylab='销量')
3.3.6: asp
asp
the y/x aspect ratio
官方文档: plot函数
plot函数--R语言相关推荐
- quantile函数r语言_R中的Quantile()函数-简要指南
quantile函数r语言 You can generate the sample quantiles using the quantile() function in R. 您可以使用R中的Quan ...
- c r语言中rank函数,R语言rank函数详细解析
R语言rank函数详细解析 发布于 2016-01-04 16:26:04 | 557 次阅读 | 评论: 0 | 来源: PHPERZ R 数据统计分析语言R是用于统计分析.绘图的语言和操作环境.R ...
- matlab 雷达图函数,R语言之可视化(20)ggradar雷达图
目录 R语言之可视化(20)ggradar雷达图 ======================= ggradar是一个ggplot2函数,主要用于绘制数据分析的雷达图. 它基于Ricardo Bion ...
- plot函数_R语言基础绘图函数散点图~跟着Nature Communications学画图~Figure1
今天继续 跟着Nature Communications学画图系列第二篇.学习R语言基础绘图函数画散点图. 对应的 Nature Communications 的论文是 Fecal pollution ...
- c语言分组求和函数,R语言 实现data.frame 分组计数、求和等
df为1个data.frame对象,有stratum和psu两列,这里统计stratum列计数 方法1: cnt = table(df$stratum) 方法2: cnt = tapply(df$ps ...
- 1071svm函数 r语言_R语言机器学习之核心包e1071 - 数据分析
R语言有很多包可以做机器学习(Machine Learning)的任务.机器学习的任务主要有有监督的学习方式和无监督的学习方式. 有监督学习:在正确结果指导下的学习方式,若是正确结果是定性的,属于分类 ...
- 自定义函数 | R语言偏相关分析及绘图
R语言的偏相关分析过程 偏相关分析介绍 阶偏相关分析: 偏相关系数: Pearson相关系数 Spearman相关系数 Kendall等级相关系数 R语言实现偏相关分析 pcor() pcor.tes ...
- r 语言c函数,R语言常用函数详解
R语言对于我们生信人员来讲,再熟悉不过,然而任何一门语言想要学好,必须经过常年的日积月累才可以做到,在这里,我列举R中常用的函数的用法, 供大家学习. 1.序列函数seq 用法: seq(form,t ...
- c 语言matrix函数,R语言矩阵matrix函数
矩阵是元素布置成二维矩形布局的R对象. 它们包含相同原子类型的元素.尽管我们可以创建只包含字符或只逻辑值的矩阵,但是它们没有多大用处.我们使用的是在数学计算中含有数字元素矩阵. 使用 matrix() ...
- c语言apply函数,R语言apply()函数用法(示例代码)
在R语言的帮助文档里,apply函数的功能是: Retruns a vector or array or list of values obtained by applying a function ...
最新文章
- 创建图像 php,详解php创建图像具体步骤
- 雷林鹏分享:PHP 魔术常量
- 第十二周项目一-实现复数类中的运算符重载(3)
- 【计算机网络】物理层 : 基本概念 ( 概述 | 概念 | 机械特性 | 电气特性 | 功能特性 | 规程特性 )
- redission收发命令流程分析
- 周五话运营 | 和用户谈一段不分手的恋爱(留存分析)
- AOSP6.0.1 系统中增加新的category类型与app绑定,并在hotseat容器中加载app
- wamp新建虚拟目录无法运行的解决方法
- uc点网页显示服务器升级,让uc浏览器网页加载速度提升100%
- 保存画面为图片 当前MFC保存该程序为图片 c++ vc
- GB2312编码理解
- ## 2019-8-30 光滑粒子流体力学开源软件(Dual)sphysics使用中遇到的一些问题1
- 对RS232接口的详细攻破
- 近红外二区量子点CdTe/Zns,CdHgTe,CdTe/CdSe,CdS、CdSe、CdTe,ZnS、ZnSe偶联抗肿瘤药物阿霉素/紫杉醇/顺铂/喜树碱
- (PTA)数据结构(作业)7、栈和队列应用,字符串矩阵,树
- Cadence 禁止start page的方法
- 通用 OCR API 接口
- 财务福音。用Python+OCR人工智能识别发票自动存入Excel表格保姆级教程
- 三种批量删除PLSQL写法效率的比对
- 深入理解数据库连接池DBCP