R语言画点状误差线
现在项目需要R语言做几个线性拟合,画一些点图,突然需要画误差线,网上找了下,可以用代码实现。。效果如下
xx1<-c(xxxxxx,xxxx,xxxxx)
yy1<-c(xxxxxx,xxxx,xxxxx)
std1<-c(xxxxxx,xxxx,xxxxx)
std2<-c(xxxxxx,xxxx,xxxxx)
plot_stdy <- function(x, y, sd, len = 1, col = "black") {
len <- len * 0.05
arrows(x0 = x, y0 = y, x1 = x, y1 = y - sd, col = col, angle = 90, length = len)
arrows(x0 = x, y0 = y, x1 = x, y1 = y + sd, col = col, angle = 90, length = len)
}
plot_stdx <- function(x, y, sd, len = 1, col = "black") {
len <- len * 0.05
arrows(x0 = x, y0 = y, x1 = x-sd, y1 =y , col = col, angle = 90,length = len)
arrows(x0 = x, y0 = y, x1 = x+sd, y1 =y, col = col , angle = 90,length = len)
}
plot(xx1,yy1)
plot_stdy(xx1, yy1, sd = std2)
plot_stdx(xx1, yy1, sd = std1)
R语言画点状误差线的更多相关文章
- R语言:表格的线图转化
R语言:表格的线图转化 最先选取的是北京各区普通住宅成交十年(2016年及2006年)涨幅对比.这张图比较plain,主要拿来练习: 1.数据表格的基本整理及计算 2. 数据的初步分析 3.线图的基本 ...
- R语言-画线图
R语言分高水平作图函数和低水平作图函数 高水平作图函数:可以独立绘图,例如plot() 低水平作图函数:必须先运行高水平作图函数绘图,然后再加画在已有的图上面 第一种方法:plot()函数 > ...
- R语言画棒状图(bar chart)和误差棒(error bar)
假设我们现在有CC,CG,GG三种基因型及三种基因型对应的表型,我们现在想要画出不同的基因型对应表型的棒状图及误差棒.整个命令最重要的就是最后一句了,用arrows函数画误差棒.用到的R语言如下: d ...
- R语言画全基因组关联分析中的曼哈顿图(manhattan plot)
1.在linux中安装好R 2.准备好画曼哈顿图的R脚本即manhattan.r,manhattan.r内容如下: #!/usr/bin/Rscript #example : Rscript plot ...
- R语言画曲线图
本文以1950年到2010年期间我国的火灾统计数据为例,数据如下所示: (0)加载数据 data<-read.csv("E:\\MyDocument\\p\\Data\\1950~20 ...
- R语言-画散点图
plot()函数 plot(cars$dist~cars$speed, # y~x main="XXX", ...
- R语言-画柱形图
barplot()函数 1.柱形图 > sales<-read.csv("citysales.csv",header=TRUE) #读取数据 > barplot( ...
- R语言绘图:箱线图
使用ggplot2绘制箱线图 ######*****绘制箱线图代码*****####### data1$学区房 <- factor(data1$school, levels = 0:1, lab ...
- 用R语言 画条形图(基于ggplot2包)
1.用qplot(x,data=data,geom.=”bar”,weight=y)+scale_y_continuous("y")画出y关于x的条形. 图中提示binwidth这 ...
随机推荐
- 两步完成ssh免密码登录
1.生成公钥/私钥 ssh-keygen -N '' 生成公钥在/root/.ssh目录下. 2.分发公钥 ssh-copy-id root@192.168.137.141 192.168.137.1 ...
- python简说(六)判断
非空即真,非0即真True '1' [1] {k-v}False '' None [] {}
- HDU 1848 Fibonacci again and again【博弈SG】
Problem Description 任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的: F(1)=1; F(2)=2; F(n)=F(n-1)+F( ...
- 逆波兰表达式|2013年蓝桥杯A组题解析第六题-fishers
逆波兰表达式 正常的表达式称为中缀表达式,运算符在中间,主要是给人阅读的,机器求解并不方便. 例如:3 + 5 * (2 + 6) - 1 而且,常常需要用括号来改变运算次序. 相反,如果使用逆波兰表 ...
- Linux command: grep
How to use grep to match multiple strings in the same line? grep 'string1\|string2' filename grep -E ...
- (转)Introductory guide to Generative Adversarial Networks (GANs) and their promise!
Introductory guide to Generative Adversarial Networks (GANs) and their promise! Introduction Neural ...
- 17秋 SDN课程 第三次上机作业
SDN 第三次上机作业 1.创建拓扑 2.利用OVS命令下发流表,实现vlan功能 3.利用OVS命令查看流表 s1: s2: 4.验证性测试 5.Wireshark 抓包验证
- HDU 2612 Find a way(找条路)
HDU 2612 Find a way(找条路) 00 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem ...
- hdu 6134 Battlestation Operational 莫比乌斯反演
Battlestation Operational Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Jav ...
- git创建、删除分支
//创建分支 git branch branchname //创建并切换到新分支 git checkout -b branchname //远程分支 git push origin branchnam ...