Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 带std误差的散点图_R - Fatal编程技术网

R 带std误差的散点图

R 带std误差的散点图,r,R,大家好,特别是所有R程序员,我需要你们的帮助。我正在尝试用std错误条绘制散点图![在此处输入图像描述][1]但我无法管理它。到目前为止,我可以用标签和45度角线(我也需要)制作散点图。如果有人帮助我或在我现有的代码中添加一些代码,这将对我非常有帮助 我的代码 Dataset <- read.table("AvgDis.csv",header=TRUE, sep="", na.strings="NA", dec=".",

大家好,特别是所有R程序员,我需要你们的帮助。我正在尝试用std错误条绘制散点图![在此处输入图像描述][1]但我无法管理它。到目前为止,我可以用标签和45度角线(我也需要)制作散点图。如果有人帮助我或在我现有的代码中添加一些代码,这将对我非常有帮助

我的代码

Dataset <- read.table("AvgDis.csv",header=TRUE, sep="", 
                      na.strings="NA", dec=".", 
                      strip.white=TRUE)

plot(Dataset$True,Dataset$False, 
     xlim=c(0,100), ylim=c(0,100), 
     main="Average % of disorder", 
     xlab="True", ylab="False", 
     pch=19,col= "blue")

text(Dataset$True,Dataset$False, 
     labels=Dataset$MotifId, 
     cex= 0.7, pos=3)

abline(0,1)

首先,我要创建一个假数据框,因为您发布数据的方式不方便复制和粘贴

# Make a fake dataset since it is inconvenient to copy & paste the data you show
set.seed(13)
False <- rnorm(10, mean=50, sd=10)
True <- rnorm(10, mean=50, sd=10)
MotifId <- letters[1:10]
Dataset <- data.frame(False, True, MotifId)

从长远来看,我认为最好使用
ggplot2
数据可视化软件包

require(ggplot2)
# Build the plot from layers 
p <- ggplot(Dataset, aes(x=True, y=False, label=MotifId)) + 
       geom_point() + 
       geom_text(, vjust=1, hjust=1) +
       geom_errorbar(aes(ymin=False-stderr, ymax=False+stderr), width=1) +
       geom_abline(slope=1, intercept=0) +
       xlim(c(0, 100)) +
       ylim(c(0, 100)) +
       ggtitle("Average % of disorder") +
       theme_bw()
print(p)
require(ggplot2)
#从图层构建绘图

p您试图输入图像,但不知何故它被删除了。平均值(x)或平均值(y)可能存在标准偏差,相关系数或回归线可能存在CI,但您尚未说明具体情况。感谢您的帮助:)
Dataset$stderr <- 7 # This will recycle to the number of rows of Dataset
plot(Dataset$True,Dataset$False, 
     xlim=c(0,100), ylim=c(0,100), 
     main="Average % of disorder", 
     xlab="True", ylab="False", 
     pch=19,col= "blue")
text(Dataset$True,Dataset$False, 
     labels=Dataset$MotifId, 
     cex= 0.7, pos=3)
abline(0,1)
arrows(x0=Dataset$True, y0=Dataset$False - Dataset$stderr, 
       x1=Dataset$True, y1=Dataset$False + Dataset$stderr, 
       angle=90, code=3, length=0.05)
require(ggplot2)
# Build the plot from layers 
p <- ggplot(Dataset, aes(x=True, y=False, label=MotifId)) + 
       geom_point() + 
       geom_text(, vjust=1, hjust=1) +
       geom_errorbar(aes(ymin=False-stderr, ymax=False+stderr), width=1) +
       geom_abline(slope=1, intercept=0) +
       xlim(c(0, 100)) +
       ylim(c(0, 100)) +
       ggtitle("Average % of disorder") +
       theme_bw()
print(p)